Skip to content

Commit

Permalink
slub: Simplify control flow in __slab_alloc()
Browse files Browse the repository at this point in the history
Simplify control flow a bit avoiding nesting.

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 7ced371 commit f469743
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2272,17 +2272,15 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
/* Then do expensive stuff like retrieving pages from the partial lists */
freelist = get_partial(s, gfpflags, node, c);

if (unlikely(!freelist)) {

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

if (unlikely(!freelist)) {
if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
slab_out_of_memory(s, gfpflags, node);
if (unlikely(!freelist)) {
if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
slab_out_of_memory(s, gfpflags, node);

local_irq_restore(flags);
return NULL;
}
local_irq_restore(flags);
return NULL;
}

if (likely(!kmem_cache_debug(s)))
Expand Down

0 comments on commit f469743

Please sign in to comment.