[patch 02/10] slab: minor cleanup to kmem_cache_alloc_node

From: Pekka Enberg
Date: Sat Jan 14 2006 - 07:44:54 EST


From: Christoph Lameter <clameter@xxxxxxxxxxxx>

This patch cleans up kmem_cache_alloc_node a bit.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
Acked-by: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---

mm/slab.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)

Index: 2.6/mm/slab.c
===================================================================
--- 2.6.orig/mm/slab.c
+++ 2.6/mm/slab.c
@@ -2916,27 +2916,18 @@ void *kmem_cache_alloc_node(kmem_cache_t
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 */
- printk(KERN_WARNING
- "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);
local_irq_save(save_flags);
- if (nodeid == numa_node_id())
+
+ if (nodeid == -1 || nodeid == numa_node_id() ||
+ !cachep->nodelists[nodeid])
ptr = ____cache_alloc(cachep, flags);
else
ptr = __cache_alloc_node(cachep, flags, nodeid);
local_irq_restore(save_flags);
- ptr =
- cache_alloc_debugcheck_after(cachep, flags, ptr,
- __builtin_return_address(0));
+
+ ptr = cache_alloc_debugcheck_after(cachep, flags, ptr,
+ __builtin_return_address(0));

return ptr;
}

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/