Commit 92be2e33b155ee76399f51f41fb061f850d02f08
Committed by
Linus Torvalds
1 parent
77a8a78834
Exists in
master
and in
7 other branches
[PATCH] mm: microopt conditions
Micro optimise some conditionals where we don't need lazy evaluation. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
mm/page_alloc.c
... | ... | @@ -336,9 +336,9 @@ |
336 | 336 | |
337 | 337 | static inline int free_pages_check(const char *function, struct page *page) |
338 | 338 | { |
339 | - if ( page_mapcount(page) || | |
340 | - page->mapping != NULL || | |
341 | - page_count(page) != 0 || | |
339 | + if (unlikely(page_mapcount(page) | | |
340 | + (page->mapping != NULL) | | |
341 | + (page_count(page) != 0) | | |
342 | 342 | (page->flags & ( |
343 | 343 | 1 << PG_lru | |
344 | 344 | 1 << PG_private | |
... | ... | @@ -348,7 +348,7 @@ |
348 | 348 | 1 << PG_slab | |
349 | 349 | 1 << PG_swapcache | |
350 | 350 | 1 << PG_writeback | |
351 | - 1 << PG_reserved ))) | |
351 | + 1 << PG_reserved )))) | |
352 | 352 | bad_page(function, page); |
353 | 353 | if (PageDirty(page)) |
354 | 354 | __ClearPageDirty(page); |
... | ... | @@ -458,9 +458,9 @@ |
458 | 458 | */ |
459 | 459 | static int prep_new_page(struct page *page, int order) |
460 | 460 | { |
461 | - if ( page_mapcount(page) || | |
462 | - page->mapping != NULL || | |
463 | - page_count(page) != 0 || | |
461 | + if (unlikely(page_mapcount(page) | | |
462 | + (page->mapping != NULL) | | |
463 | + (page_count(page) != 0) | | |
464 | 464 | (page->flags & ( |
465 | 465 | 1 << PG_lru | |
466 | 466 | 1 << PG_private | |
... | ... | @@ -471,7 +471,7 @@ |
471 | 471 | 1 << PG_slab | |
472 | 472 | 1 << PG_swapcache | |
473 | 473 | 1 << PG_writeback | |
474 | - 1 << PG_reserved ))) | |
474 | + 1 << PG_reserved )))) | |
475 | 475 | bad_page(__FUNCTION__, page); |
476 | 476 | |
477 | 477 | /* |