From: Christoph Lameter In two places in the VM we use ZONE_DMA to refer to the first zone. If ZONE_DMA is optional then other zones may be first. So simply replace ZONE_DMA with zone 0. This also fixes ZONETABLE_PGSHIFT. If we have only a single zone then ZONES_PGSHIFT may become 0 because there is no need anymore to encode the zone number related to a pgdat. However, we still need a zonetable to index all the zones for each node if this is a NUMA system. Therefore define ZONETABLE_SHIFT unconditionally as the offset of the ZONE field in page flags. Acked-by: Christoph Hellwig Signed-off-by: Christoph Lameter Cc: Andi Kleen Cc: "Luck, Tony" Cc: Kyle McMartin Cc: Matthew Wilcox Cc: James Bottomley Cc: Paul Mundt Signed-off-by: Andrew Morton --- include/linux/mm.h | 2 +- mm/mempolicy.c | 2 +- mm/page_alloc.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff -puN include/linux/mm.h~deal-with-cases-of-zone_dma-meaning-the-first-zone include/linux/mm.h --- a/include/linux/mm.h~deal-with-cases-of-zone_dma-meaning-the-first-zone +++ a/include/linux/mm.h @@ -418,7 +418,7 @@ void split_page(struct page *page, unsig #else #define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT) #endif -#define ZONEID_PGSHIFT ZONES_PGSHIFT +#define ZONEID_PGSHIFT ZONES_PGOFF #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED diff -puN mm/mempolicy.c~deal-with-cases-of-zone_dma-meaning-the-first-zone mm/mempolicy.c --- a/mm/mempolicy.c~deal-with-cases-of-zone_dma-meaning-the-first-zone +++ a/mm/mempolicy.c @@ -105,7 +105,7 @@ static struct kmem_cache *sn_cache; /* Highest zone. An specific allocation for a zone below that is not policied. */ -enum zone_type policy_zone = ZONE_DMA; +enum zone_type policy_zone = 0; struct mempolicy default_policy = { .refcnt = ATOMIC_INIT(1), /* never free it */ diff -puN mm/page_alloc.c~deal-with-cases-of-zone_dma-meaning-the-first-zone mm/page_alloc.c --- a/mm/page_alloc.c~deal-with-cases-of-zone_dma-meaning-the-first-zone +++ a/mm/page_alloc.c @@ -2363,11 +2363,11 @@ static void __meminit free_area_init_cor " %s zone: %lu pages exceeds realsize %lu\n", zone_names[j], memmap_pages, realsize); - /* Account for reserved DMA pages */ - if (j == ZONE_DMA && realsize > dma_reserve) { + /* Account for reserved pages */ + if (j == 0 && realsize > dma_reserve) { realsize -= dma_reserve; - printk(KERN_DEBUG " DMA zone: %lu pages reserved\n", - dma_reserve); + printk(KERN_DEBUG " %s zone: %lu pages reserved\n", + zone_names[0], dma_reserve); } if (!is_highmem_idx(j)) _