diff options
author | Christoph Hellwig <hch@lst.de> | 2006-09-26 02:31:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:49 -0400 |
commit | dbe5e69d2d6e591996ea2b817b887d03b60bb143 (patch) | |
tree | 09e21f2e0da60faef982d02a9224e62c409e776a /include/linux | |
parent | da6052f7b33abe55fbfd7d2213815f58c00a88d4 (diff) |
[PATCH] slab: optimize kmalloc_node the same way as kmalloc
[akpm@osdl.org: export fix]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/slab.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 193c03c547ec..2f6bef6a98c9 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -202,7 +202,30 @@ extern int slab_is_available(void); | |||
202 | 202 | ||
203 | #ifdef CONFIG_NUMA | 203 | #ifdef CONFIG_NUMA |
204 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); | 204 | extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); |
205 | extern void *kmalloc_node(size_t size, gfp_t flags, int node); | 205 | extern void *__kmalloc_node(size_t size, gfp_t flags, int node); |
206 | |||
207 | static inline void *kmalloc_node(size_t size, gfp_t flags, int node) | ||
208 | { | ||
209 | if (__builtin_constant_p(size)) { | ||
210 | int i = 0; | ||
211 | #define CACHE(x) \ | ||
212 | if (size <= x) \ | ||
213 | goto found; \ | ||
214 | else \ | ||
215 | i++; | ||
216 | #include "kmalloc_sizes.h" | ||
217 | #undef CACHE | ||
218 | { | ||
219 | extern void __you_cannot_kmalloc_that_much(void); | ||
220 | __you_cannot_kmalloc_that_much(); | ||
221 | } | ||
222 | found: | ||
223 | return kmem_cache_alloc_node((flags & GFP_DMA) ? | ||
224 | malloc_sizes[i].cs_dmacachep : | ||
225 | malloc_sizes[i].cs_cachep, flags, node); | ||
226 | } | ||
227 | return __kmalloc_node(size, flags, node); | ||
228 | } | ||
206 | #else | 229 | #else |
207 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) | 230 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) |
208 | { | 231 | { |