lkml.org 
[lkml]   [2001]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: page_launder() bug
Rusty Russell wrote:
>
> In message <15094.10942.592911.70443@pizda.ninka.net> you write:
> >
> > Jonathan Morton writes:
> > > >- page_count(page) == (1 + !!page->buffers));
> > >
> > > Two inversions in a row?
> >
> > It is the most straightforward way to make a '1' or '0'
> > integer from the NULL state of a pointer.
>
> Overall, I'd have to say that this:
>
> - dead_swap_page =
> - (PageSwapCache(page) &&
> - page_count(page) == (1 + !!page->buffers));
> -
>
> Is nicer as:
>
> int dead_swap_page = 0;
>
> if (PageSwapCache(page)
> && page_count(page) == (page->buffers ? 1 : 2))
> dead_swap_page = 1;
>
> After all, the second is what the code *means* (1 and 2 are magic
> numbers).
>
> That said, anyone who doesn't understand the former should probably
> get some more C experience before commenting on others' code...

Basically Amen.

But there are may be better chances that the compiler does do
better job at branch prediction in the second case?
Wenn anyway objdump -S should show it...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.114 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site