path: root/mm/slob.c
diff options
authorChristoph Lameter <>2013-09-04 16:35:34 +0000
committerPekka Enberg <>2013-09-04 20:51:33 +0300
commitf1b6eb6e6be149b40ebb013f5bfe2ac86b6f1c1b (patch)
tree245897276adc30bc17a23ba1b5364a065e2ecb74 /mm/slob.c
parent9de1bc875261411bf0a900e90cfe0c7a31c4917b (diff)
mm/sl[aou]b: Move kmallocXXX functions to common code
The kmalloc* functions of all slab allcoators are similar now so lets move them into slab.h. This requires some function naming changes in slob. As a results of this patch there is a common set of functions for all allocators. Also means that kmalloc_large() is now available in general to perform large order allocations that go directly via the page allocator. kmalloc_large() can be substituted if kmalloc() throws warnings because of too large allocations. kmalloc_large() has exactly the same semantics as kmalloc but can only used for allocations > PAGE_SIZE. Signed-off-by: Christoph Lameter <> Signed-off-by: Pekka Enberg <>
Diffstat (limited to 'mm/slob.c')
1 files changed, 24 insertions, 4 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 91bd3f2dd2f0..4bf8809dfcce 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -462,11 +462,11 @@ __do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller)
return ret;
-void *__kmalloc_node(size_t size, gfp_t gfp, int node)
+void *__kmalloc(size_t size, gfp_t gfp)
- return __do_kmalloc_node(size, gfp, node, _RET_IP_);
+ return __do_kmalloc_node(size, gfp, NUMA_NO_NODE, _RET_IP_);
void *__kmalloc_track_caller(size_t size, gfp_t gfp, unsigned long caller)
@@ -534,7 +534,7 @@ int __kmem_cache_create(struct kmem_cache *c, unsigned long flags)
return 0;
-void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
+void *slob_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
void *b;
@@ -560,7 +560,27 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
kmemleak_alloc_recursive(b, c->size, 1, c->flags, flags);
return b;
+void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
+ return slob_alloc_node(cachep, flags, NUMA_NO_NODE);
+void *__kmalloc_node(size_t size, gfp_t gfp, int node)
+ return __do_kmalloc_node(size, gfp, node, _RET_IP_);
+void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t gfp, int node)
+ return slob_alloc_node(cachep, gfp, node);
static void __kmem_cache_free(void *b, int size)