On Mon, 2009-01-19 at 17:00 +0530, Chandru wrote:
> --- linux-2.6.29-rc2/arch/powerpc/mm/numa.c.orig      2009-01-19 
> 16:14:49.000000000 +0530
> +++ linux-2.6.29-rc2/arch/powerpc/mm/numa.c   2009-01-19 16:36:38.000000000 
> +0530
> @@ -901,7 +901,8 @@ static void mark_reserved_regions_for_ni
>               get_node_active_region(start_pfn, &node_ar);
>               while (start_pfn < end_pfn &&
>                       node_ar.start_pfn < node_ar.end_pfn) {
> -                     unsigned long reserve_size = size;
> +                     unsigned long reserve_size = (size >> PAGE_SHIFT) <<
> +                                                             PAGE_SHIFT;
>                       /*
>                        * if reserved region extends past active region
>                        * then trim size to active region
> @@ -917,7 +918,8 @@ static void mark_reserved_regions_for_ni
>                               dbg("reserve_bootmem %lx %lx nid=%d\n",
>                                       physbase, reserve_size, node_ar.nid);
>                               reserve_bootmem_node(NODE_DATA(node_ar.nid),
> -                                             physbase, reserve_size,
> +                                             (start_pfn << PAGE_SHIFT),
> +                                             reserve_size,
>                                               BOOTMEM_DEFAULT);
>                       }
>                       /*

Chandru, I don't mean to keep ragging on your patches, but I really
don't think this is right, yet.

Let's take, for instance, a 1-byte reservation.  With this code, you've
suddenly turned that into a 0-byte reservation, and that *can't* be
right.  The same thing happens if you have a reservation that spans two
pages.  If you unconditionally round it down, then you might miss the
part that spans a portion of the second page.

It needs to be rounded down like you are suggesting here, but only in
the case where we've gone over the *CURRENT* node's boundary.  This is
kinda what that "if (end_pfn > node_ar.end_pfn)" check is doing.  But,
it evidently screws it up if the overlap isn't by an entire page or
something.

Please also, for pete's sake, use masks (a la PAGE_MASK) or macros if
you're going to page-align something.  Don't shift down and up like
that.  

-- Dave

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to