public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SLUB: Fix __GFP_ZERO unlikely() annotation
@ 2009-11-25 18:21 Pekka Enberg
  2009-11-25 18:27 ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2009-11-25 18:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Christoph Lameter

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

Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 mm/slub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 4996fc7..0956396 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-27 19:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 18:21 [PATCH] SLUB: Fix __GFP_ZERO unlikely() annotation Pekka Enberg
2009-11-25 18:27 ` Joe Perches
2009-11-25 18:30   ` Pekka Enberg
2009-11-25 20:15     ` Christoph Lameter
2009-11-25 20:19       ` Pekka Enberg
2009-11-26 20:27       ` Pekka Enberg
2009-11-27 19:26         ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox