[RFC 4/8] page allocator: Optional ZONE_DMA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-07 15:29:50.265384678 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 16:44:03.067357437 -0700
@@ -88,6 +88,7 @@ struct per_cpu_pageset {
 #endif
 
 typedef enum {
+#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 @@ typedef enum {
 	 * 			<16M.
 	 */
 	ZONE_DMA,
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	/*
 	 * x86_64 needs two ZONE_DMAs because it supports devices that are
@@ -172,8 +174,13 @@ typedef enum {
 #define GFP_ZONEMASK		0x03
 #define	ZONES_SHIFT		2
 #else
+#ifdef CONFIG_DMA
 #define GFP_ZONEMASK		0x01
 #define ZONES_SHIFT		1
+#else
+#define GFP_ZONEMASK		0x00
+#define ZONES_SHIFT		0
+#endif
 #endif
 #endif
 
@@ -464,7 +471,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.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:29:50.265384678 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 16:44:03.069310441 -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
@@ -1485,8 +1489,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.17-mm6/mm/mempolicy.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/mempolicy.c	2006-07-06 11:46:23.152072668 -0700
+++ linux-2.6.17-mm6/mm/mempolicy.c	2006-07-07 16:44:03.070286943 -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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux