[PATCH] mm: optimize numa policy handling in slab allocator
authorChristoph Lameter <clameter@engr.sgi.com>
Thu, 19 Jan 2006 01:42:37 +0000 (17:42 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 19 Jan 2006 03:20:18 +0000 (19:20 -0800)
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 <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/mempolicy.c
mm/slab.c

index 71430d440822f69e98e7944f35d5d375ff4070a5..73790188b0eb27a91edd4d0d8efba6c90d4b28be 100644 (file)
@@ -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);
index 9025608696ec9bb83d1010d3b09aed9796668c33..6f8495e2185b36c4d4e08402a111a59a3deeb01b 100644 (file)
--- 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())