Commit 18f820f6 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds

[PATCH] slab: minor cleanup to kmem_cache_alloc_node

Clean up kmem_cache_alloc_node a bit.
Signed-off-by: default avatarChristoph Lameter <>
Acked-by: default avatarManfred Spraul <>
Signed-off-by: default avatarPekka Enberg <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 3dafccf2
......@@ -2928,27 +2928,18 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid)
unsigned long save_flags;
void *ptr;
if (nodeid == -1)
return __cache_alloc(cachep, flags);
if (unlikely(!cachep->nodelists[nodeid])) {
/* Fall back to __cache_alloc if we run into trouble */
"slab: not allocating in inactive node %d for cache %s\n",
nodeid, cachep->name);
return __cache_alloc(cachep, flags);
cache_alloc_debugcheck_before(cachep, flags);
if (nodeid == numa_node_id())
if (nodeid == -1 || nodeid == numa_node_id() ||
ptr = ____cache_alloc(cachep, flags);
ptr = __cache_alloc_node(cachep, flags, nodeid);
ptr =
cache_alloc_debugcheck_after(cachep, flags, ptr,
ptr = cache_alloc_debugcheck_after(cachep, flags, ptr,
return ptr;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment