[patch 2/2] mm: use vm_unmapped_area() on powerpc architecture
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Mon Mar 18 23:27:44 EST 2013
Michel Lespinasse <walken at google.com> writes:
> 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.
>
aha, I missed the fact that it was to handle slice = 0 && end == 0
case. I was looking it as looping back to start slice in high slice
range once we reached 0xffffffff. Above slice 63 in high slice, we
should have available always unset, so beyond that we can ideally
loop back to SLICE_LOW_TOP right ?
-aneesh
More information about the Linuxppc-dev
mailing list