diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2013-08-01 22:02:42 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2013-08-14 11:26:10 -0400 |
commit | 9de1bc875261411bf0a900e90cfe0c7a31c4917b (patch) | |
tree | 8452af4e203a28294f86734c17619a048e31c755 /mm/slab_common.c | |
parent | 68f06650ea63f38e1cca7b5bbd56a9c1b8ac5209 (diff) |
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 <cl@linux.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
373 | { | 373 | { |
374 | int index; | 374 | int index; |
375 | 375 | ||
376 | if (size > KMALLOC_MAX_SIZE) { | 376 | if (unlikely(size > KMALLOC_MAX_SIZE)) { |
377 | WARN_ON_ONCE(!(flags & __GFP_NOWARN)); | 377 | WARN_ON_ONCE(!(flags & __GFP_NOWARN)); |
378 | return NULL; | 378 | return NULL; |
379 | } | 379 | } |