[patch 3/3] Fix MPOL_INTERLEAVE behavior for memoryless nodes

clameter
2007-06-12T20:48:46Z

[-- Attachment #1: fix_interleave --]
[-- Type: text/plain, Size: 1339 bytes --]

MPOL_INTERLEAVE currently simply loops over all nodes. Allocations on
memoryless nodes will be redirected to nodes with memory. This results in
an imbalance because the neighboring nodes to memoryless nodes will get
significantly more interleave hits that the rest of the nodes.

We can avoid this imbalance by clearing the nodes in the interleave node
set that have no memory.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

Index: linux-2.6.22-rc4-mm2/mm/mempolicy.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/mm/mempolicy.c 2007-06-12 13:45:16.000000000 -0700
+++ linux-2.6.22-rc4-mm2/mm/mempolicy.c 2007-06-12 13:45:31.000000000 -0700
@@ -185,7 +185,8 @@ static struct mempolicy *mpol_new(int mo
switch (mode) {
case MPOL_INTERLEAVE:
policy->v.nodes = *nodes;
- if (nodes_weight(*nodes) == 0) {
+ nodes_and(policy->v.nodes, policy->v.nodes, node_memory_map);
+ if (nodes_weight(policy->v.nodes) == 0) {
kmem_cache_free(policy_cache, policy);
return ERR_PTR(-EINVAL);
}