From: "Aneesh Kumar K.V" <aneesh.kumar@linux•vnet.ibm.com>
To: Michel Lespinasse <walken@google•com>
Cc: akpm@linux-foundation•org, paulus@samba•org,
linuxppc-dev@lists•ozlabs.org
Subject: Re: [patch 2/2] mm: use vm_unmapped_area() on powerpc architecture
Date: Mon, 18 Mar 2013 17:57:44 +0530 [thread overview]
Message-ID: <87a9q03nb3.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <CANN689H_Q8RBmyuF6hqOB+prZciHTUPudfhs_+y0p2peHwTdTw@mail.gmail.com>
Michel Lespinasse <walken@google•com> writes:
> On Mon, Mar 18, 2013 at 4:12 AM, Aneesh Kumar K.V
> <aneesh.kumar@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
next prev parent reply other threads:[~2013-03-18 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-21 23:05 [patch 2/2] mm: use vm_unmapped_area() on powerpc architecture akpm
2013-03-18 10:40 ` Aneesh Kumar K.V
2013-03-18 11:12 ` Aneesh Kumar K.V
2013-03-18 11:23 ` Michel Lespinasse
2013-03-18 12:27 ` Aneesh Kumar K.V [this message]
2013-03-19 6:31 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a9q03nb3.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux$(echo .)vnet.ibm.com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=paulus@samba$(echo .)org \
--cc=walken@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox