lkml.org 
[lkml]   [2005]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[patch 5/12] mm: microopt conditions
    Date
    Micro optimise some conditionals where we don't need lazy evaluation.

    Signed-off-by: Nick Piggin <npiggin@suse.de>

    Index: linux-2.6/mm/page_alloc.c
    ===================================================================
    --- linux-2.6.orig/mm/page_alloc.c
    +++ linux-2.6/mm/page_alloc.c
    @@ -342,9 +342,9 @@ static inline void __free_pages_bulk (st

    static inline void free_pages_check(const char *function, struct page *page)
    {
    - if ( 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 |
    @@ -354,7 +354,7 @@ static inline void free_pages_check(cons
    1 << PG_slab |
    1 << PG_swapcache |
    1 << PG_writeback |
    - 1 << PG_reserved )))
    + 1 << PG_reserved ))))
    bad_page(function, page);
    if (PageDirty(page))
    __ClearPageDirty(page);
    @@ -455,9 +455,9 @@ expand(struct zone *zone, struct page *p
    */
    static void prep_new_page(struct page *page, int order)
    {
    - if ( 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 |
    @@ -468,7 +468,7 @@ static void prep_new_page(struct page *p
    1 << PG_slab |
    1 << PG_swapcache |
    1 << PG_writeback |
    - 1 << PG_reserved )))
    + 1 << PG_reserved ))))
    bad_page(__FUNCTION__, page);

    page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
    Send instant messages to your online friends http://au.messenger.yahoo.com
    -
    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-11-21 14:27    [W:0.022 / U:122.844 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site