Skip to content

Commit

Permalink
slub: new_slab_objects() can also get objects from partial list
Browse files Browse the repository at this point in the history
Moving the attempt to get a slab page from the partial lists simplifies
__slab_alloc which is rather complicated.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed Jun 1, 2012
1 parent f469743 commit 188fd06
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,9 +2130,15 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
int node, struct kmem_cache_cpu **pc)
{
void *freelist;
struct kmem_cache_cpu *c;
struct page *page = new_slab(s, flags, node);
struct kmem_cache_cpu *c = *pc;
struct page *page;

freelist = get_partial(s, flags, node, c);

if (freelist)
return freelist;

page = new_slab(s, flags, node);
if (page) {
c = __this_cpu_ptr(s->cpu_slab);
if (c->page)
Expand Down Expand Up @@ -2269,11 +2275,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
goto redo;
}

/* Then do expensive stuff like retrieving pages from the partial lists */
freelist = get_partial(s, gfpflags, node, c);

if (!freelist)
freelist = new_slab_objects(s, gfpflags, node, &c);
freelist = new_slab_objects(s, gfpflags, node, &c);

if (unlikely(!freelist)) {
if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
Expand Down

0 comments on commit 188fd06

Please sign in to comment.