From 9de1bc875261411bf0a900e90cfe0c7a31c4917b Mon Sep 17 00:00:00 2001 From: Joonsoo Kim Date: Fri, 2 Aug 2013 11:02:42 +0900 Subject: mm, slab_common: add 'unlikely' to size check of kmalloc_slab() Size is usually below than KMALLOC_MAX_SIZE. If we add a 'unlikely' macro, compiler can make better code. Acked-by: Christoph Lameter Signed-off-by: Joonsoo Kim Signed-off-by: Pekka Enberg --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mm/slab_common.c') diff --git a/mm/slab_common.c b/mm/slab_common.c index 538bade6df7d..f0410eb61741 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -373,7 +373,7 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) { int index; - if (size > KMALLOC_MAX_SIZE) { + if (unlikely(size > KMALLOC_MAX_SIZE)) { WARN_ON_ONCE(!(flags & __GFP_NOWARN)); return NULL; } -- cgit v1.2.3-70-g09d2