Re: [PATCH] mm/page_alloc.c: fix a typo

Li Zefan
2008-05-07T04:34:09Z

Li Zefan wrote:
>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>> index bdd5c43..d0ba10d 100644
>>> --- a/mm/page_alloc.c
>>> +++ b/mm/page_alloc.c
>>> @@ -303,7 +303,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
>>> for (i = 1; i < nr_pages; i++) {
>>> struct page *p = page + i;
>>>
>>> - if (unlikely(!PageTail(p) |
>>> + if (unlikely(!PageTail(p) ||
>>> (p->first_page != page)))
>>> bad_page(page);
>>> __ClearPageTail(p);
>> I have a vague memory that the "|" was deliberate. Most of the time,
>> "!PageTail" will be false so most of the time we won't take the first
>
> !PageTail will be true if nothing bad happened, corrected me if I'm wrong:
>

Silly, I was wrong...

Christoph Lameter wrote:
> I think the | there was some developers attempt to avoid gcc generating
> too many branches. I am fine either way.
>

Yes, I found out it's 224abf92b2f439a9030f21d2926ec8047d1ffcdb :

[PATCH] mm: bad_page optimisation
Nick Piggin [Fri, 6 Jan 2006 08:11:11 +0000 (00:11 -0800)]

Cut down size slightly by not passing bad_page the function name (it should be
able to be determined by dump_stack()). And cut down the number of printks in
bad_page.

Also, cut down some branching in the destroy_compound_page path.