From: Jesse Barnes If NUMA is enabled, find_next_best_node is responsible for helping build the zonelist for each pgdat in the system. However, if one sets PENALTY_FOR_NODE_WITH_CPUS to a large value in an attempt to prefer nodes w/o CPUs, the local node is erroneously placed after all nodes w/o CPUs in the pgdat's zonelist. This small patch fixes that by just checking if the local node is part of the zonelist yet, and if not, returns it first. Signed-off-by: Jesse Barnes Signed-off-by: Andrew Morton --- 25-akpm/mm/page_alloc.c | 6 ++++++ 1 files changed, 6 insertions(+) diff -puN mm/page_alloc.c~fix-find_next_best_node mm/page_alloc.c --- 25/mm/page_alloc.c~fix-find_next_best_node Thu Nov 4 14:34:20 2004 +++ 25-akpm/mm/page_alloc.c Thu Nov 4 14:34:20 2004 @@ -1234,6 +1234,12 @@ static int __init find_next_best_node(in if (test_bit(n, used_node_mask)) continue; + /* Use the local node if we haven't already */ + if (!test_bit(node, used_node_mask)) { + best_node = node; + break; + } + /* Use the distance array to find the distance */ val = node_distance(node, n); _