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/slub_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/slub_def.h')
-rw-r--r-- | include/linux/slub_def.h | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index bae11111458..07f7e4cbcee 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -179,19 +179,6 @@ static inline void *kmalloc(size_t size, gfp_t flags) | |||
179 | return __kmalloc(size, flags); | 179 | return __kmalloc(size, flags); |
180 | } | 180 | } |
181 | 181 | ||
182 | static inline void *kzalloc(size_t size, gfp_t flags) | ||
183 | { | ||
184 | if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { | ||
185 | struct kmem_cache *s = kmalloc_slab(size); | ||
186 | |||
187 | if (!s) | ||
188 | return ZERO_SIZE_PTR; | ||
189 | |||
190 | return kmem_cache_zalloc(s, flags); | ||
191 | } else | ||
192 | return __kzalloc(size, flags); | ||
193 | } | ||
194 | |||
195 | #ifdef CONFIG_NUMA | 182 | #ifdef CONFIG_NUMA |
196 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 183 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
197 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 184 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |