Simplify build_zonelists_node by removing the case statement. Signed-off-by: Christoph Lameter Index: linux-2.6.15-rc5-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.15-rc5-mm1.orig/mm/page_alloc.c 2005-12-06 17:22:51.000000000 -0800 +++ linux-2.6.15-rc5-mm1/mm/page_alloc.c 2005-12-06 19:22:26.000000000 -0800 @@ -1567,35 +1567,21 @@ 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; + 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 (populated_zone(zone)) - zonelist->zones[j++] = zone; - case ZONE_DMA32: - zone = pgdat->node_zones + ZONE_DMA32; - if (populated_zone(zone)) - zonelist->zones[j++] = zone; - case ZONE_DMA: - zone = pgdat->node_zones + ZONE_DMA; - if (populated_zone(zone)) - zonelist->zones[j++] = zone; - } - return j; }