diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-07-17 07:03:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:01 -0400 |
commit | 81cda6626178cd55297831296ba8ecedbfd8b52d (patch) | |
tree | fa35a6a04db63080bbeb42f33f4b4a891b7fc96c /include/linux/slab_def.h | |
parent | ce15fea8274acca06daa1674322d37a7d3f0036b (diff) |
Slab allocators: Cleanup zeroing allocations
It becomes now easy to support the zeroing allocs with generic inline
functions in slab.h. Provide inline definitions to allow the continued use of
kzalloc, kmem_cache_zalloc etc but remove other definitions of zeroing
functions from the slab allocators and util.c.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/slab_def.h')
-rw-r--r-- | include/linux/slab_def.h | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 16e814ffab8d..32bdc2ffd715 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -58,36 +58,6 @@ found: | |||
58 | return __kmalloc(size, flags); | 58 | return __kmalloc(size, flags); |
59 | } | 59 | } |
60 | 60 | ||
61 | static inline void *kzalloc(size_t size, gfp_t flags) | ||
62 | { | ||
63 | if (__builtin_constant_p(size)) { | ||
64 | int i = 0; | ||
65 | |||
66 | if (!size) | ||
67 | return ZERO_SIZE_PTR; | ||
68 | |||
69 | #define CACHE(x) \ | ||
70 | if (size <= x) \ | ||
71 | goto found; \ | ||
72 | else \ | ||
73 | i++; | ||
74 | #include "kmalloc_sizes.h" | ||
75 | #undef CACHE | ||
76 | { | ||
77 | extern void __you_cannot_kzalloc_that_much(void); | ||
78 | __you_cannot_kzalloc_that_much(); | ||
79 | } | ||
80 | found: | ||
81 | #ifdef CONFIG_ZONE_DMA | ||
82 | if (flags & GFP_DMA) | ||
83 | return kmem_cache_zalloc(malloc_sizes[i].cs_dmacachep, | ||
84 | flags); | ||
85 | #endif | ||
86 | return kmem_cache_zalloc(malloc_sizes[i].cs_cachep, flags); | ||
87 | } | ||
88 | return __kzalloc(size, flags); | ||
89 | } | ||
90 | |||
91 | #ifdef CONFIG_NUMA | 61 | #ifdef CONFIG_NUMA |
92 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | 62 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
93 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 63 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |