Skip to content

Commit

Permalink
mm, slab_common: add 'unlikely' to size check of kmalloc_slab()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JoonsooKim authored and penberg committed Aug 14, 2013
1 parent 68f0665 commit 9de1bc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9de1bc8

Please sign in to comment.