linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: kosaki.motohiro@jp.fujitsu.com, akpm@linux-foundation.org,
	linux-mm@kvack.org, hugh.dickins@tiscali.co.uk,
	nickpiggin@yahoo.com.au
Subject: Re: [PATCH] page_alloc: change bit ops 'or' to logical ops in free/new  page check
Date: Tue, 26 Jan 2010 16:00:25 +0900 (JST)	[thread overview]
Message-ID: <20100126155852.1D53.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <cf18f8341001252256q65b90d76vfe3094a1bb5424e7@mail.gmail.com>

> Using logical 'or' in  function free_page_mlock() and
> check_new_page() makes code clear and
> sometimes more effective (Because it can ignore other condition
> compare if the first condition
> is already true).
> 
> It's Nick's patch "mm: microopt conditions" changed it from logical
> ops to bit ops.
> Maybe I didn't consider something. If so, please let me know and just
> ignore this patch.
> Thanks!

I think current code is intentional. On modern cpu, bit-or is faster than
logical or.

Do you have opposite benchmark number result?


> 
> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
> 
> diff --git mm/page_alloc.c mm/page_alloc.c
> index 05ae4e0..91ece14 100644
> --- mm/page_alloc.c
> +++ mm/page_alloc.c
> @@ -500,9 +500,9 @@ static inline void free_page_mlock(struct page *page)
> 
>  static inline int free_pages_check(struct page *page)
>  {
> -       if (unlikely(page_mapcount(page) |
> -               (page->mapping != NULL)  |
> -               (atomic_read(&page->_count) != 0) |
> +       if (unlikely(page_mapcount(page) ||
> +               (page->mapping != NULL)  ||
> +               (atomic_read(&page->_count) != 0) ||
>                 (page->flags & PAGE_FLAGS_CHECK_AT_FREE))) {
>                 bad_page(page);
>                 return 1;
> @@ -671,9 +671,9 @@ static inline void expand(struct zone *zone, struct page *pa
>   */
>  static inline int check_new_page(struct page *page)
>  {
> -       if (unlikely(page_mapcount(page) |
> -               (page->mapping != NULL)  |
> -               (atomic_read(&page->_count) != 0)  |
> +       if (unlikely(page_mapcount(page) ||
> +               (page->mapping != NULL)  ||
> +               (atomic_read(&page->_count) != 0)  ||
>                 (page->flags & PAGE_FLAGS_CHECK_AT_PREP))) {
>                 bad_page(page);
>                 return 1;
> 
> -- 
> Regards,
> -Bob Liu
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-01-26  7:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26  6:56 Bob Liu
2010-01-26  7:00 ` KOSAKI Motohiro [this message]
2010-01-26  8:20   ` Bob Liu
2010-01-27 16:52     ` Hugh Dickins

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=20100126155852.1D53.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.com \
    --cc=nickpiggin@yahoo.com.au \
    /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