From: Christoph Lameter Date: Thu, 19 Jan 2006 01:42:37 +0000 (-0800) Subject: [PATCH] mm: optimize numa policy handling in slab allocator X-Git-Tag: firefly_0821_release~38703 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=86c562a9d6683063e071692fe14e0a18e64ee1be;p=firefly-linux-kernel-4.4.55.git [PATCH] mm: optimize numa policy handling in slab allocator Move the interrupt check from slab_node into ___cache_alloc and adds an "unlikely()" to avoid pipeline stalls on some architectures. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 71430d440822..73790188b0eb 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -982,9 +982,6 @@ static unsigned interleave_nodes(struct mempolicy *policy) */ unsigned slab_node(struct mempolicy *policy) { - if (in_interrupt()) - return numa_node_id(); - switch (policy->policy) { case MPOL_INTERLEAVE: return interleave_nodes(policy); diff --git a/mm/slab.c b/mm/slab.c index 9025608696ec..6f8495e2185b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2574,7 +2574,7 @@ static inline void *____cache_alloc(kmem_cache_t *cachep, gfp_t flags) struct array_cache *ac; #ifdef CONFIG_NUMA - if (current->mempolicy) { + if (unlikely(current->mempolicy && !in_interrupt())) { int nid = slab_node(current->mempolicy); if (nid != numa_node_id())