mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[PATCH] slab: optimize constant-size kzalloc calls
As suggested by Eric Dumazet, optimize kzalloc() calls that pass a compile-time constant size. Please note that the patch increases kernel text slightly (~200 bytes for defconfig on x86). Signed-off-by: Pekka Enberg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a8c0f9a41f
commit
40c07ae8da
2 changed files with 30 additions and 6 deletions
|
|
@ -5,18 +5,18 @@
|
|||
#include <asm/uaccess.h>
|
||||
|
||||
/**
|
||||
* kzalloc - allocate memory. The memory is set to zero.
|
||||
* __kzalloc - allocate memory. The memory is set to zero.
|
||||
* @size: how many bytes of memory are required.
|
||||
* @flags: the type of memory to allocate.
|
||||
*/
|
||||
void *kzalloc(size_t size, gfp_t flags)
|
||||
void *__kzalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
void *ret = ____kmalloc(size, flags);
|
||||
if (ret)
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(kzalloc);
|
||||
EXPORT_SYMBOL(__kzalloc);
|
||||
|
||||
/*
|
||||
* kstrdup - allocate space for and copy an existing string
|
||||
|
|
|
|||
Loading…
Reference in a new issue