diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2006-03-25 06:06:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:22:49 -0500 |
commit | 40c07ae8daa659b8feb149c84731629386873c16 (patch) | |
tree | 77d9e7572135de30f184103cc6dd36f9c0f8dfbf /mm | |
parent | a8c0f9a41f88da703ade33f9c1626a55c786e8bb (diff) |
[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 <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -5,18 +5,18 @@ | |||
5 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * kzalloc - allocate memory. The memory is set to zero. | 8 | * __kzalloc - allocate memory. The memory is set to zero. |
9 | * @size: how many bytes of memory are required. | 9 | * @size: how many bytes of memory are required. |
10 | * @flags: the type of memory to allocate. | 10 | * @flags: the type of memory to allocate. |
11 | */ | 11 | */ |
12 | void *kzalloc(size_t size, gfp_t flags) | 12 | void *__kzalloc(size_t size, gfp_t flags) |
13 | { | 13 | { |
14 | void *ret = ____kmalloc(size, flags); | 14 | void *ret = ____kmalloc(size, flags); |
15 | if (ret) | 15 | if (ret) |
16 | memset(ret, 0, size); | 16 | memset(ret, 0, size); |
17 | return ret; | 17 | return ret; |
18 | } | 18 | } |
19 | EXPORT_SYMBOL(kzalloc); | 19 | EXPORT_SYMBOL(__kzalloc); |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * kstrdup - allocate space for and copy an existing string | 22 | * kstrdup - allocate space for and copy an existing string |