This patch gets rid of one if-else statement by moving current node allocation
check at the beginning of kmem_cache_alloc_node().
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
slab.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 7f80ec3..a05bbfe 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2881,7 +2881,7 @@ void *kmem_cache_alloc_node(kmem_cache_t
unsigned long save_flags;
void *ptr;
- if (nodeid == -1)
+ if (nodeid == -1 || nodeid == numa_node_id())
return __cache_alloc(cachep, flags);
if (unlikely(!cachep->nodelists[nodeid])) {
@@ -2892,10 +2892,7 @@ void *kmem_cache_alloc_node(kmem_cache_t
cache_alloc_debugcheck_before(cachep, flags);
local_irq_save(save_flags);
- if (nodeid == numa_node_id())
- ptr = ____cache_alloc(cachep, flags);
- else
- ptr = __cache_alloc_node(cachep, flags, nodeid);
+ ptr = __cache_alloc_node(cachep, flags, nodeid);
local_irq_restore(save_flags);
ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, __builtin_return_address(0));