[patch 2/2] mm: use vm_unmapped_area() on powerpc architecture

Michel Lespinasse walken at google.com
Mon Mar 18 22:23:35 EST 2013


On Mon, Mar 18, 2013 at 4:12 AM, Aneesh Kumar K.V
<aneesh.kumar at linux.vnet.ibm.com> wrote:
> how about  ?
>
> static bool slice_scan_available(unsigned long addr,
>                                  struct slice_mask available,
>                                  int end,
>                                  unsigned long *boundary_addr)
> {
>         unsigned long slice;
>         if (addr < SLICE_LOW_TOP) {
>                 slice = GET_LOW_SLICE_INDEX(addr);
>                 *boundary_addr = (slice + end) << SLICE_LOW_SHIFT;
>                 return !!(available.low_slices & (1u << slice));
>         } else {
>                 slice = GET_HIGH_SLICE_INDEX(addr);

>                 if ((slice + end) >= SLICE_NUM_HIGH)
>                         /* loop back in the high slice */
>                         *boundary_addr = SLICE_LOW_TOP;
>                 else
>                         *boundary_addr = (slice + end) << SLICE_HIGH_SHIFT;

I don't mind having this section as an if..else rather than ?:
statement. However, the condition would need to be if (slice == 0 &&
end == 0) or if (slice + end == 0)

This is because the beginning of high slice 0 is at SLICE_LOW_TOP and not at 0,
and the end of high slice 63 is at 64TB not at SLICE_LOW_TOP.

>                 return !!(available.high_slices & (1u << slice));
>         }
> }

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.


More information about the Linuxppc-dev mailing list