mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
68f06650ea
commit
9de1bc8752
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue