Re: free_pages_check

From: Andrew Morton
Date: Mon Jan 07 2008 - 22:08:37 EST


On Mon, 7 Jan 2008 18:43:46 -0800 "Yinghai Lu" <yhlu.kernel@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/