]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] mm: simplify build_zonelists_node by removing the case statement.
authorChristoph Lameter <clameter@engr.sgi.com>
Fri, 6 Jan 2006 08:11:16 +0000 (00:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:33:28 +0000 (08:33 -0800)
Simplify build_zonelists_node by removing the case statement.

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 8f3de5af92ddbdd77b6b0d5282133888515e48be..7adc9526d329fb99957b091333b9f0f54ccdc2a3 100644 (file)
@@ -1455,35 +1455,23 @@ void show_free_areas(void)
 
 /*
  * Builds allocation fallback zone lists.
+ *
+ * Add all populated zones of a node to the zonelist.
  */
-static int __init build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist, int j, int k)
-{
-       switch (k) {
-               struct zone *zone;
-       default:
-               BUG();
-       case ZONE_HIGHMEM:
-               zone = pgdat->node_zones + ZONE_HIGHMEM;
-               if (zone->present_pages) {
+static int __init build_zonelists_node(pg_data_t *pgdat,
+                       struct zonelist *zonelist, int j, int k)
+{
+       struct zone *zone;
+
+       BUG_ON(k > ZONE_HIGHMEM);
+       for (zone = pgdat->node_zones + k; zone >= pgdat->node_zones; zone--) {
+               if (populated_zone(zone)) {
 #ifndef CONFIG_HIGHMEM
-                       BUG();
+                       BUG_ON(zone - pgdat->node_zones > ZONE_NORMAL);
 #endif
                        zonelist->zones[j++] = zone;
                }
-       case ZONE_NORMAL:
-               zone = pgdat->node_zones + ZONE_NORMAL;
-               if (zone->present_pages)
-                       zonelist->zones[j++] = zone;
-       case ZONE_DMA32:
-               zone = pgdat->node_zones + ZONE_DMA32;
-               if (zone->present_pages)
-                       zonelist->zones[j++] = zone;
-       case ZONE_DMA:
-               zone = pgdat->node_zones + ZONE_DMA;
-               if (zone->present_pages)
-                       zonelist->zones[j++] = zone;
        }
-
        return j;
 }