Make ZONE_DMA optional in the page allocator - ifdef all code for ZONE_DMA and related definitions. - Without ZONE_DMA, ZONE_HIGHMEM and ZONE_DMA32 we fall back to an empty GFP_ZONEMASK and a ZONES_SHIFT of zero (since there is only one zone....). - We need to fix the use of ZONE_DMA in the memory policy layer. ZONE_DMA is used there as the first zone so use 0 instead. Signed-off-by: Christoph Lameter Index: linux-2.6.18-rc1-mm1/include/linux/mmzone.h =================================================================== --- linux-2.6.18-rc1-mm1.orig/include/linux/mmzone.h 2006-07-10 10:35:17.009345406 -0700 +++ linux-2.6.18-rc1-mm1/include/linux/mmzone.h 2006-07-10 11:13:41.428262351 -0700 @@ -88,6 +88,7 @@ struct per_cpu_pageset { #endif enum zone_type { +#ifdef CONFIG_ZONE_DMA /* * ZONE_DMA is used when there are devices that are not able * to do DMA to all of addressable memory (ZONE_NORMAL). Then we @@ -108,6 +109,7 @@ enum zone_type { * <16M. */ ZONE_DMA, +#endif #ifdef CONFIG_ZONE_DMA32 /* * x86_64 needs two ZONE_DMAs because it supports devices that are @@ -184,11 +186,18 @@ enum zone_type { #define GFP_ZONETYPES 3 #else +#ifdef CONFIG_ZONE_DMA #define GFP_ZONEMASK 0x01 #define ZONES_SHIFT 1 #define GFP_ZONETYPES 2 +#else +#define GFP_ZONEMASK 0x00 +#define ZONES_SHIFT 0 +#define GFP_ZONETYPES 1 +#endif + #endif #endif @@ -479,7 +488,11 @@ static inline int is_dma32(struct zone * static inline int is_dma(struct zone *zone) { +#ifdef CONFIG_ZONE_DMA return zone == zone->zone_pgdat->node_zones + ZONE_DMA; +#else + return 0; +#endif } /* These two functions are used to setup the per zone pages min values */ Index: linux-2.6.18-rc1-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.18-rc1-mm1.orig/mm/page_alloc.c 2006-07-10 10:47:40.420309927 -0700 +++ linux-2.6.18-rc1-mm1/mm/page_alloc.c 2006-07-10 11:11:50.129475277 -0700 @@ -69,7 +69,9 @@ static void __free_pages_ok(struct page * don't need any ZONE_NORMAL reservation */ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { +#ifdef CONFIG_ZONE_DMA 256, +#endif #ifdef CONFIG_ZONE_DMA32 256, #endif @@ -88,7 +90,9 @@ struct zone *zone_table[1 << ZONETABLE_S EXPORT_SYMBOL(zone_table); static char *zone_names[MAX_NR_ZONES] = { +#ifdef CONFIG_ZONE_DMA "DMA", +#endif #ifdef CONFIG_ZONE_DMA32 "DMA32", #endif @@ -1483,8 +1487,10 @@ static inline int highest_zone(int zone_ if (zone_bits & (__force int)__GFP_DMA32) res = ZONE_DMA32; #endif +#ifdef CONFIG_ZONE_DMA if (zone_bits & (__force int)__GFP_DMA) res = ZONE_DMA; +#endif return res; } Index: linux-2.6.18-rc1-mm1/mm/mempolicy.c =================================================================== --- linux-2.6.18-rc1-mm1.orig/mm/mempolicy.c 2006-07-05 21:09:49.000000000 -0700 +++ linux-2.6.18-rc1-mm1/mm/mempolicy.c 2006-07-10 11:11:50.134357788 -0700 @@ -105,7 +105,7 @@ static struct kmem_cache *sn_cache; /* Highest zone. An specific allocation for a zone below that is not policied. */ -int policy_zone = ZONE_DMA; +int policy_zone = 0; struct mempolicy default_policy = { .refcnt = ATOMIC_INIT(1), /* never free it */