Skip to content

Commit

Permalink
SLUB: Fix __GFP_ZERO unlikely() annotation
Browse files Browse the repository at this point in the history
The unlikely() annotation in slab_alloc() covers too much of the expression.
It's actually very likely that the object is not NULL so use unlikely() only
for the __GFP_ZERO expression like SLAB does.

The patch reduces kernel text by 29 bytes on x86-64:

   text	   data	    bss	    dec	    hex	filename
  24185	   8560	    176	  32921	   8099	mm/slub.o.orig
  24156	   8560	    176	  32892	   807c	mm/slub.o

Acked-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
  • Loading branch information
Pekka Enberg committed Nov 29, 2009
1 parent b419148 commit 74e2134
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
}
local_irq_restore(flags);

if (unlikely((gfpflags & __GFP_ZERO) && object))
if (unlikely(gfpflags & __GFP_ZERO) && object)
memset(object, 0, objsize);

kmemcheck_slab_alloc(s, gfpflags, object, c->objsize);
Expand Down

0 comments on commit 74e2134

Please sign in to comment.