linux 增加一个zone

--- old/include/linux/gfp.h	2013-11-12 22:08:24.000000000 -0500
+++ new/include/linux/gfp.h	2013-12-03 14:07:59.067137000 -0500
@@ -35,6 +35,7 @@
 #define ___GFP_NO_KSWAPD	0x400000u
 #define ___GFP_OTHER_NODE	0x800000u
 #define ___GFP_WRITE		0x1000000u
+#define ___GFP_NVM             0x2000000u
 /* If the above are modified, __GFP_BITS_SHIFT may need updating */
 
 /*
@@ -152,6 +153,7 @@
 
 /* 4GB DMA on some platforms */
 #define GFP_DMA32	__GFP_DMA32
+#define GFP_NVM    __GFP_NVM
 
 /* Convert GFP flags to their corresponding migrate type */
 static inline int allocflags_to_migratetype(gfp_t gfp_flags)
@@ -222,14 +224,14 @@
 #endif
 
 #define GFP_ZONE_TABLE ( \
-	(ZONE_NORMAL << 0 * ZONES_SHIFT)				      \
-	| (OPT_ZONE_DMA << ___GFP_DMA * ZONES_SHIFT)			      \
-	| (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * ZONES_SHIFT)		      \
-	| (OPT_ZONE_DMA32 << ___GFP_DMA32 * ZONES_SHIFT)		      \
-	| (ZONE_NORMAL << ___GFP_MOVABLE * ZONES_SHIFT)			      \
-	| (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * ZONES_SHIFT)	      \
-	| (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * ZONES_SHIFT)   \
-	| (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * ZONES_SHIFT)   \
+	((__force unsigned long)ZONE_NORMAL << 0 * ZONES_SHIFT)				      \
+	| ((__force unsigned long)OPT_ZONE_DMA << ___GFP_DMA * ZONES_SHIFT)			      \
+	| ((__force unsigned long)OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * ZONES_SHIFT)		      \
+	| ((__force unsigned long)OPT_ZONE_DMA32 << ___GFP_DMA32 * ZONES_SHIFT)		      \
+	| ((__force unsigned long)ZONE_NORMAL << ___GFP_MOVABLE * ZONES_SHIFT)			      \
+	| ((__force unsigned long)OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * ZONES_SHIFT)	      \
+	| ((__force unsigned long)ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * ZONES_SHIFT)   \
+	| ((__force unsigned long)OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * ZONES_SHIFT)   \
 )
 
 /*


--- old/arch/x86/mm/init.c	2013-11-12 22:08:24.000000000 -0500
+++ new/arch/x86/mm/init.c	2013-12-03 14:09:45.628146000 -0500
@@ -572,9 +572,10 @@
 	max_zone_pfns[ZONE_DMA]		= MAX_DMA_PFN;
 #endif
 #ifdef CONFIG_ZONE_DMA32
-	max_zone_pfns[ZONE_DMA32]	= MAX_DMA32_PFN;
+	max_zone_pfns[ZONE_DMA32]	= MAX_DMA32_PFN / 2;
 #endif
-	max_zone_pfns[ZONE_NORMAL]	= max_low_pfn;
+	max_zone_pfns[ZONE_NORMAL]	= MAX_DMA32_PFN;
+	max_zone_pfns[ZONE_NVM]		= max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 	max_zone_pfns[ZONE_HIGHMEM]	= max_pfn;
 #endif

--- old/include/linux/mmzone.h	2013-11-12 22:08:24.000000000 -0500
+++ new/include/linux/mmzone.h	2013-12-03 19:31:19.454768000 -0500
@@ -304,6 +304,7 @@
 	 */
 	ZONE_HIGHMEM,
 #endif
+	ZONE_NVM,
 	ZONE_MOVABLE,
 	__MAX_NR_ZONES
 };

--- old/mm/page_alloc.c	2013-11-12 22:08:24.000000000 -0500
+++ new/mm/page_alloc.c	2013-12-03 14:15:26.298174000 -0500
@@ -197,6 +197,7 @@
 	 "DMA32",
 #endif
 	 "Normal",
+	 "NVM",
 #ifdef CONFIG_HIGHMEM
 	 "HighMem",
 #endif
@@ -1864,6 +1865,9 @@
 	 */
 	for_each_zone_zonelist_nodemask(zone, z, zonelist,
 						high_zoneidx, nodemask) {
+		if(zone_idx(zone)==ZONE_NVM){
+				continue;
+		}
 		if (IS_ENABLED(CONFIG_NUMA) && zlc_active &&
 			!zlc_zone_worth_trying(zonelist, z, allowednodes))
 				continue;

--- old/include/linux/page-flags-layout.h	2013-11-12 22:08:24.000000000 -0500
+++ new/include/linux/page-flags-layout.h	2013-12-03 14:22:50.962210000 -0500
@@ -18,7 +18,8 @@
 #elif MAX_NR_ZONES <= 4
 #define ZONES_SHIFT 2
 #else
-#error ZONES_SHIFT -- too many zones configured adjust calculation
+#define ZONES_SHIFT 3
+//#error ZONES_SHIFT -- too many zones configured adjust calculation
 #endif
 
 #ifdef CONFIG_SPARSEMEM


你可能感兴趣的:(linux 增加一个zone)