Commit 188fd063 authored by Christoph Lameter's avatar Christoph Lameter Committed by Pekka Enberg

slub: new_slab_objects() can also get objects from partial list

Moving the attempt to get a slab page from the partial lists simplifies
__slab_alloc which is rather complicated.
Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent f4697436
...@@ -2130,9 +2130,15 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags, ...@@ -2130,9 +2130,15 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
int node, struct kmem_cache_cpu **pc) int node, struct kmem_cache_cpu **pc)
{ {
void *freelist; void *freelist;
struct kmem_cache_cpu *c; struct kmem_cache_cpu *c = *pc;
struct page *page = new_slab(s, flags, node); struct page *page;
freelist = get_partial(s, flags, node, c);
if (freelist)
return freelist;
page = new_slab(s, flags, node);
if (page) { if (page) {
c = __this_cpu_ptr(s->cpu_slab); c = __this_cpu_ptr(s->cpu_slab);
if (c->page) if (c->page)
...@@ -2269,11 +2275,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, ...@@ -2269,11 +2275,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
goto redo; goto redo;
} }
/* Then do expensive stuff like retrieving pages from the partial lists */ freelist = new_slab_objects(s, gfpflags, node, &c);
freelist = get_partial(s, gfpflags, node, c);
if (!freelist)
freelist = new_slab_objects(s, gfpflags, node, &c);
if (unlikely(!freelist)) { if (unlikely(!freelist)) {
if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit()) if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment