public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Yinghai Lu" <yhlu.kernel@gmail.com>
Cc: "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: Mon, 7 Jan 2008 19:08:22 -0800	[thread overview]
Message-ID: <20080107190822.b13c9f97.akpm@linux-foundation.org> (raw)
In-Reply-To: <86802c440801071843p583f390as53f8b600622b93b2@mail.gmail.com>

On Mon, 7 Jan 2008 18:43:46 -0800 "Yinghai Lu" <yhlu.kernel@gmail.com> 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 |

It's a hack^Wtrick to avoid the generation of a series of not-taken
branches.  I don't recall anyone verifying that it is actually of any
benefit, but the theory is good.

The lack of a comment, however, is not.

  reply	other threads:[~2008-01-08  3:08 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 ` Andrew Morton [this message]
2008-01-08  3:34 ` free_pages_check Nick Piggin
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=20080107190822.b13c9f97.akpm@linux-foundation.org \
    --to=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