lkml.org 
[lkml]   [2008]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: free_pages_check
Date
On Tuesday 08 January 2008 16:44, H. Peter Anvin wrote:
> Nick Piggin wrote:
> > 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.
>
> Depends on how smart the compiler is. If the page_() functions are
> inlines or macros, there is only one pointer reference involved and it
> should be able to do that transformation. Whether or not gcc is that
> smart is another matter.

Mine is not.


\
 
 \ /
  Last update: 2008-01-08 08:47    [W:0.034 / U:4.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site