Commit dbe5e69d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds
Browse files

[PATCH] slab: optimize kmalloc_node the same way as kmalloc



[akpm@osdl.org: export fix]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent da6052f7
...@@ -202,7 +202,30 @@ extern int slab_is_available(void); ...@@ -202,7 +202,30 @@ extern int slab_is_available(void);
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
extern void *kmalloc_node(size_t size, gfp_t flags, int node); extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
{
if (__builtin_constant_p(size)) {
int i = 0;
#define CACHE(x) \
if (size <= x) \
goto found; \
else \
i++;
#include "kmalloc_sizes.h"
#undef CACHE
{
extern void __you_cannot_kmalloc_that_much(void);
__you_cannot_kmalloc_that_much();
}
found:
return kmem_cache_alloc_node((flags & GFP_DMA) ?
malloc_sizes[i].cs_dmacachep :
malloc_sizes[i].cs_cachep, flags, node);
}
return __kmalloc_node(size, flags, node);
}
#else #else
static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
{ {
......
...@@ -3348,7 +3348,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid) ...@@ -3348,7 +3348,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
} }
EXPORT_SYMBOL(kmem_cache_alloc_node); EXPORT_SYMBOL(kmem_cache_alloc_node);
void *kmalloc_node(size_t size, gfp_t flags, int node) void *__kmalloc_node(size_t size, gfp_t flags, int node)
{ {
struct kmem_cache *cachep; struct kmem_cache *cachep;
...@@ -3357,7 +3357,7 @@ void *kmalloc_node(size_t size, gfp_t flags, int node) ...@@ -3357,7 +3357,7 @@ void *kmalloc_node(size_t size, gfp_t flags, int node)
return NULL; return NULL;
return kmem_cache_alloc_node(cachep, flags, node); return kmem_cache_alloc_node(cachep, flags, node);
} }
EXPORT_SYMBOL(kmalloc_node); EXPORT_SYMBOL(__kmalloc_node);
#endif #endif
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment