aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slab_def.h
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-07-17 07:03:29 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:01 -0400
commit81cda6626178cd55297831296ba8ecedbfd8b52d (patch)
treefa35a6a04db63080bbeb42f33f4b4a891b7fc96c /include/linux/slab_def.h
parentce15fea8274acca06daa1674322d37a7d3f0036b (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.h30
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
61static 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 }
80found:
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
92extern void *__kmalloc_node(size_t size, gfp_t flags, int node); 62extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
93extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 63extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);