linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.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 04:23:35 -0700	[thread overview]
Message-ID: <CANN689H_Q8RBmyuF6hqOB+prZciHTUPudfhs_+y0p2peHwTdTw@mail.gmail.com> (raw)
In-Reply-To: <87d2ux2c7w.fsf@linux.vnet.ibm.com>

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.

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

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

  reply	other threads:[~2013-03-18 11:23 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 [this message]
2013-03-18 12:27     ` Aneesh Kumar K.V
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=CANN689H_Q8RBmyuF6hqOB+prZciHTUPudfhs_+y0p2peHwTdTw@mail.gmail.com \
    --to=walken@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).