public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Yinghai Lu" <yhlu.kernel@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Christoph Lameter" <clameter@sgi.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Adrian Bunk" <bunk@stusta.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: free_pages_check
Date: Tue, 8 Jan 2008 14:34:14 +1100	[thread overview]
Message-ID: <200801081434.14723.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <86802c440801071843p583f390as53f8b600622b93b2@mail.gmail.com>

On Tuesday 08 January 2008 13:43, Yinghai Lu wrote:
> wonder why free_pages_check mm/page_alloc.c is using bit OR than logical OR
>
> @@ -450,9 +450,9 @@ static inline void __free_one_page(struc
>
>  static inline int free_pages_check(struct page *page)
>  {
> -       if (unlikely(page_mapcount(page) |
> -               (page->mapping != NULL)  |
> -               (page_count(page) != 0)  |
> +       if (unlikely(page_mapcount(page) ||
> +               (page->mapping != NULL)  ||
> +               (page_count(page) != 0)  ||
>                 (page->flags & (
>                         1 << PG_lru     |
>                         1 << PG_private |

Because the positive case is extremely rare, so there is no benefit (nor
any correctness requirement) for short-circuit evaluation, and we don't
want to have all the branches that it involves. I think it is 3 more
conditional jumps.

  parent reply	other threads:[~2008-01-08  3:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08  2:43 free_pages_check Yinghai Lu
2008-01-08  3:08 ` free_pages_check Andrew Morton
2008-01-08  3:34 ` Nick Piggin [this message]
2008-01-08  5:44   ` free_pages_check H. Peter Anvin
2008-01-08  7:44     ` free_pages_check Nick Piggin

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=200801081434.14723.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@stusta.de \
    --cc=clameter@sgi.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yhlu.kernel@gmail.com \
    /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