Index: linux-2.6.18-rc5-mm1/include/linux/mmzone.h =================================================================== --- linux-2.6.18-rc5-mm1.orig/include/linux/mmzone.h 2006-09-03 21:31:07.000000000 -0700 +++ linux-2.6.18-rc5-mm1/include/linux/mmzone.h 2006-09-03 21:31:23.000000000 -0700 @@ -261,7 +261,12 @@ /* * Discontig memory support fields. */ +#ifdef MULTI_ZONE struct pglist_data *zone_pgdat; +#define get_pgdat(__zone) ((__zone)->zone_pgdat) +#else +#define get_pgdat(__zone) container_of((__zone), struct pglist_data, node_zones[0]) +#endif /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ unsigned long zone_start_pfn; Index: linux-2.6.18-rc5-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/page_alloc.c 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/page_alloc.c 2006-09-03 21:31:23.000000000 -0700 @@ -963,7 +963,7 @@ do { zone = *z; if (unlikely((gfp_mask & __GFP_THISNODE) && - zone->zone_pgdat != zonelist->zones[0]->zone_pgdat)) + get_pgdat(zone) != get_pgdat(zonelist->zones[0]))) break; if ((alloc_flags & ALLOC_CPUSET) && !cpuset_zone_allowed(zone, gfp_mask)) @@ -2012,7 +2012,7 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) { int i; - struct pglist_data *pgdat = zone->zone_pgdat; + struct pglist_data *pgdat = get_pgdat(zone); size_t alloc_size; /* @@ -2074,7 +2074,7 @@ unsigned long zone_start_pfn, unsigned long size) { - struct pglist_data *pgdat = zone->zone_pgdat; + struct pglist_data *pgdat = get_pgdat(zone); int ret; ret = zone_wait_table_init(zone, size); if (ret) @@ -2476,7 +2476,9 @@ spin_lock_init(&zone->lock); spin_lock_init(&zone->lru_lock); zone_seqlock_init(zone); +#ifdef MULTI_ZONE zone->zone_pgdat = pgdat; +#endif zone->free_pages = 0; zone->temp_priority = zone->prev_priority = DEF_PRIORITY; Index: linux-2.6.18-rc5-mm1/mm/vmscan.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/vmscan.c 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/vmscan.c 2006-09-03 21:31:23.000000000 -0700 @@ -1298,7 +1298,7 @@ if (!populated_zone(zone)) return; - pgdat = zone->zone_pgdat; + pgdat = get_pgdat(zone); if (zone_watermark_ok(zone, order, zone->pages_low, 0, 0)) return; if (pgdat->kswapd_max_order < order) Index: linux-2.6.18-rc5-mm1/mm/vmstat.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/vmstat.c 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/vmstat.c 2006-09-03 21:31:23.000000000 -0700 @@ -364,13 +364,13 @@ */ void zone_statistics(struct zonelist *zonelist, struct zone *z) { - if (z->zone_pgdat == zonelist->zones[0]->zone_pgdat) { + if (get_pgdat(z) == get_pgdat(zonelist->zones[0])) { __inc_zone_state(z, NUMA_HIT); } else { __inc_zone_state(z, NUMA_MISS); __inc_zone_state(zonelist->zones[0], NUMA_FOREIGN); } - if (z->zone_pgdat == NODE_DATA(numa_node_id())) + if (get_pgdat(z) == NODE_DATA(numa_node_id())) __inc_zone_state(z, NUMA_LOCAL); else __inc_zone_state(z, NUMA_OTHER); Index: linux-2.6.18-rc5-mm1/mm/mmzone.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/mmzone.c 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/mmzone.c 2006-09-03 21:31:23.000000000 -0700 @@ -32,11 +32,14 @@ */ struct zone *next_zone(struct zone *zone) { - pg_data_t *pgdat = zone->zone_pgdat; + pg_data_t *pgdat = get_pgdat(zone); +#ifdef MULTI_ZONE if (zone < pgdat->node_zones + MAX_NR_ZONES - 1) zone++; - else { + else +#endif + { pgdat = next_online_pgdat(pgdat); if (pgdat) zone = pgdat->node_zones; Index: linux-2.6.18-rc5-mm1/mm/sparse.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/sparse.c 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/sparse.c 2006-09-03 21:31:23.000000000 -0700 @@ -274,7 +274,7 @@ int nr_pages) { unsigned long section_nr = pfn_to_section_nr(start_pfn); - struct pglist_data *pgdat = zone->zone_pgdat; + struct pglist_data *pgdat = get_pgdat(zone); struct mem_section *ms; struct page *memmap; unsigned long flags; Index: linux-2.6.18-rc5-mm1/include/linux/mm.h =================================================================== --- linux-2.6.18-rc5-mm1.orig/include/linux/mm.h 2006-09-03 21:28:01.000000000 -0700 +++ linux-2.6.18-rc5-mm1/include/linux/mm.h 2006-09-03 21:31:23.000000000 -0700 @@ -519,7 +519,7 @@ static inline unsigned long zone_to_nid(struct zone *zone) { - return zone->zone_pgdat->node_id; + return get_pgdat(zone)->node_id; } static inline unsigned long page_to_nid(struct page *page)