提交 dc1fb7f4 编写于 作者: C Christoph Lameter 提交者: Pekka Enberg

slub: Move node determination out of hotpath

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: NChristoph Lameter <cl@linux.com>
Signed-off-by: NPekka Enberg <penberg@kernel.org>
上级 01ad8a7b
...@@ -1828,7 +1828,6 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, ...@@ -1828,7 +1828,6 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
c->freelist = get_freepointer(s, object); c->freelist = get_freepointer(s, object);
page->inuse = page->objects; page->inuse = page->objects;
page->freelist = NULL; page->freelist = NULL;
c->node = page_to_nid(page);
unlock_out: unlock_out:
slab_unlock(page); slab_unlock(page);
...@@ -1845,8 +1844,10 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, ...@@ -1845,8 +1844,10 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
new_slab: new_slab:
page = get_partial(s, gfpflags, node); page = get_partial(s, gfpflags, node);
if (page) { if (page) {
c->page = page;
stat(s, ALLOC_FROM_PARTIAL); stat(s, ALLOC_FROM_PARTIAL);
load_from_page:
c->node = page_to_nid(page);
c->page = page;
goto load_freelist; goto load_freelist;
} }
...@@ -1867,8 +1868,8 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, ...@@ -1867,8 +1868,8 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
slab_lock(page); slab_lock(page);
__SetPageSlubFrozen(page); __SetPageSlubFrozen(page);
c->page = page;
goto load_freelist; goto load_from_page;
} }
if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit()) if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
slab_out_of_memory(s, gfpflags, node); slab_out_of_memory(s, gfpflags, node);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册