slub: Move node determination out of hotpath
authorChristoph Lameter <cl@linux.com>
Fri, 15 Apr 2011 19:48:15 +0000 (14:48 -0500)
committerPekka Enberg <penberg@kernel.org>
Sun, 17 Apr 2011 11:03:20 +0000 (14:03 +0300)
If the node does not change then there is no need to recalculate
the node from the page struct. So move the node determination
into the places where we acquire a new slab page.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slub.c

index ab44368ed692b0ec90a66d835a6f22b08de419ce..301360bc00c6b456d1fd85e736103b0f2852dbf6 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1828,7 +1828,6 @@ load_freelist:
        c->freelist = get_freepointer(s, object);
        page->inuse = page->objects;
        page->freelist = NULL;
-       c->node = page_to_nid(page);
 
 unlock_out:
        slab_unlock(page);
@@ -1845,8 +1844,10 @@ another_slab:
 new_slab:
        page = get_partial(s, gfpflags, node);
        if (page) {
-               c->page = page;
                stat(s, ALLOC_FROM_PARTIAL);
+load_from_page:
+               c->node = page_to_nid(page);
+               c->page = page;
                goto load_freelist;
        }
 
@@ -1867,8 +1868,8 @@ new_slab:
 
                slab_lock(page);
                __SetPageSlubFrozen(page);
-               c->page = page;
-               goto load_freelist;
+
+               goto load_from_page;
        }
        if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
                slab_out_of_memory(s, gfpflags, node);