Index: linux-2.6.18-rc5-mm1/include/linux/kmalloc.h =================================================================== --- linux-2.6.18-rc5-mm1.orig/include/linux/kmalloc.h 2006-09-02 21:46:56.000000000 -0700 +++ linux-2.6.18-rc5-mm1/include/linux/kmalloc.h 2006-09-02 21:48:13.000000000 -0700 @@ -93,7 +93,11 @@ static inline void *kmalloc(size_t size, gfp_t flags) { - if (__builtin_constant_p(size) && !(flags & __GFP_DMA)) { + if (__builtin_constant_p(size) +#ifdef CONFIG_ZONE_DMA + && !(flags & __GFP_DMA) +#endif + ) { struct slab_cache *s = kmalloc_slab(size); return KMALLOC_ALLOCATOR.alloc(s, flags); @@ -105,7 +109,11 @@ extern void *__kmalloc_node(size_t, gfp_t, int); static inline void *kmalloc_node(size_t size, gfp_t flags, int node) { - if (__builtin_constant_p(size) && !(flags & __GFP_DMA)) { + if (__builtin_constant_p(size) +#ifdef CONFIG_ZONE_DMA + && !(flags & __GFP_DMA) +#endif + ) { struct slab_cache *s = kmalloc_slab(size); return KMALLOC_ALLOCATOR.alloc_node(s, flags, node); Index: linux-2.6.18-rc5-mm1/mm/kmalloc.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/kmalloc.c 2006-09-02 21:46:56.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/kmalloc.c 2006-09-02 21:48:13.000000000 -0700 @@ -17,7 +17,6 @@ struct slab_control kmalloc_caches[KMALLOC_NR_CACHES] __cacheline_aligned; EXPORT_SYMBOL(kmalloc_caches); -static struct page_allocator *dma_allocator; struct page_allocator *reclaimable_allocator; struct page_allocator *unreclaimable_allocator; @@ -29,7 +28,11 @@ */ int slab_min_order = 0; +#ifdef CONFIG_ZONE_DMA +static struct page_allocator *dma_allocator; + static struct slab_cache *kmalloc_caches_dma[KMALLOC_NR_CACHES]; +#endif static int __init setup_slab_min_order(char *str) { @@ -86,14 +89,18 @@ static struct slab_cache *get_slab(size_t size, gfp_t flags) { int index = kmalloc_index(size) - KMALLOC_SHIFT_LOW; +#ifdef CONFIG_ZONE_DMA struct slab_cache *s; struct slab_control *x; size_t realsize; +#endif BUG_ON(size < 0); - +#ifdef CONFIG_ZONE_DMA if (!(flags & __GFP_DMA)) +#endif return &kmalloc_caches[index].sc; +#ifdef CONFIG_ZONE_DMA s = kmalloc_caches_dma[index]; if (s) @@ -119,6 +126,7 @@ s = create_kmalloc_cache(x, "kmalloc_dma", dma_allocator, realsize); kmalloc_caches_dma[index] = s; return s; +#endif } void *__kmalloc(size_t size, gfp_t flags) @@ -214,7 +222,9 @@ reclaimable_allocator = reclaimable_slab(&page_allocator); reclaimable_allocator->destructor = null_destructor; +#ifdef CONFIG_ZONE_DMA dma_allocator = dmaify_page_allocator(unreclaimable_allocator); +#endif /* And deal with the kmalloc_cache_allocator */ memcpy(&kmalloc_slab_allocator, &KMALLOC_ALLOCATOR, Index: linux-2.6.18-rc5-mm1/mm/slabulator.c =================================================================== --- linux-2.6.18-rc5-mm1.orig/mm/slabulator.c 2006-09-02 21:46:56.000000000 -0700 +++ linux-2.6.18-rc5-mm1/mm/slabulator.c 2006-09-02 21:48:13.000000000 -0700 @@ -102,9 +102,10 @@ else a = unreclaimable_allocator; +#ifdef CONFIG_ZONE_DMA if (flags & SLAB_CACHE_DMA) a = dmaify_page_allocator(a); - +#endif if (flags & SLAB_DESTROY_BY_RCU) a = rcuify_page_allocator(a);