Fix zone policy determination The use k in the inner loop means that the highest zone nr is always used if any zone of a node is populated. Change the loop to decrement k which also simplifies the BUG_ON. Signed-off-by: Christoph Lameter Index: linux-2.6.15-rc5-mm2/mm/page_alloc.c =================================================================== --- linux-2.6.15-rc5-mm2.orig/mm/page_alloc.c 2005-12-12 09:10:34.000000000 -0800 +++ linux-2.6.15-rc5-mm2/mm/page_alloc.c 2005-12-12 14:56:25.000000000 -0800 @@ -1579,15 +1579,19 @@ static int __init build_zonelists_node(p struct zone *zone; BUG_ON(k > ZONE_HIGHMEM); - for (zone = pgdat->node_zones + k; zone >= pgdat->node_zones; zone--) { + + do { + zone = pgdat->node_zones + k; if (populated_zone(zone)) { #ifndef CONFIG_HIGHMEM - BUG_ON(zone - pgdat->node_zones > ZONE_NORMAL); + BUG_ON(k > ZONE_NORMAL); #endif zonelist->zones[j++] = zone; check_highest_zone(k); } - } + k--; + + } while (k >= 0); return j; }