aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/slab.h25
-rw-r--r--mm/slab.c4
2 files changed, 26 insertions, 3 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
204extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 204extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
205extern void *kmalloc_node(size_t size, gfp_t flags, int node); 205extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
206
207static 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 }
222found:
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
207static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 230static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
208{ 231{
diff --git a/mm/slab.c b/mm/slab.c
index 3ad2f64998fd..5e59ce7a46c8 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3348,7 +3348,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
3348} 3348}
3349EXPORT_SYMBOL(kmem_cache_alloc_node); 3349EXPORT_SYMBOL(kmem_cache_alloc_node);
3350 3350
3351void *kmalloc_node(size_t size, gfp_t flags, int node) 3351void *__kmalloc_node(size_t size, gfp_t flags, int node)
3352{ 3352{
3353 struct kmem_cache *cachep; 3353 struct kmem_cache *cachep;
3354 3354
@@ -3357,7 +3357,7 @@ void *kmalloc_node(size_t size, gfp_t flags, int node)
3357 return NULL; 3357 return NULL;
3358 return kmem_cache_alloc_node(cachep, flags, node); 3358 return kmem_cache_alloc_node(cachep, flags, node);
3359} 3359}
3360EXPORT_SYMBOL(kmalloc_node); 3360EXPORT_SYMBOL(__kmalloc_node);
3361#endif 3361#endif
3362 3362
3363/** 3363/**