]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] Fix zone policy determination
authorChristoph Lameter <clameter@engr.sgi.com>
Fri, 6 Jan 2006 08:11:18 +0000 (00:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:33:28 +0000 (08:33 -0800)
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>
mm/page_alloc.c

index 512e3f4d4963ecf4e255ab74f7fdc1aa1b5ff494..ca978992c8987a9241c9ed59b8d986c9aa5d1b97 100644 (file)
@@ -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;
 }