diff options
author | Christoph Lameter <clameter@engr.sgi.com> | 2006-01-06 00:11:16 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 08:33:28 -0800 |
commit | 1a93205bdffd9d7278d4a66081cdb48452522a58 (patch) | |
tree | 7f8500fe725e5e8095a8fc77539d351a0e8a4643 | |
parent | f3fe65122da05e1cd4c9140340d96ea2f95d0c49 (diff) |
[PATCH] mm: simplify build_zonelists_node by removing the case statement.
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>
-rw-r--r-- | mm/page_alloc.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8f3de5af92d..7adc9526d32 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -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; } |