aboutsummaryrefslogtreecommitdiff
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@engr.sgi.com>2006-01-06 00:11:18 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 08:33:28 -0800
commit02a68a5ebc7dd823da7496116f42290103e1e4a9 (patch)
tree7b79d20246b5c9b769e4f6172fe97e6f91fb921b /mm/page_alloc.c
parent4be38e351c5f455f6f490f5aff29053e33ab4f99 (diff)
[PATCH] 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. This means that the policy zone is not correctly determined on arches that do no use HIGHMEM like ia64. Change the loop to decrement k which also simplifies the BUG_ON. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 512e3f4d496..ca978992c89 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1465,15 +1465,19 @@ static int __init build_zonelists_node(pg_data_t *pgdat,
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;
}