Re: [PATCH] CONFIG_ZONE_MOVABLE [2/2] config zone movable

Previous thread: PROBLEM: kernel 2.6.22.6 pata_pdc202xx_old.c limiting to UDMA/33 instead of UDMA/100 (UPDATED 2.6.22.6) by n on Friday, August 31, 2007 - 2:04 am. (1 message)

Next thread: [RFC][PATCH 0/6] An IPC implementation base on Linux IDRs by Nadia.Derbey on Friday, August 31, 2007 - 4:24 am. (1 message)
From: KAMEZAWA Hiroyuki
Date: Friday, August 31, 2007 - 3:12 am

This is a rebased version for making ZONE_MOVABLE configurable.

[1/2] .... clean up. this changes ZONE_xxx definitions and helps avoiding
           too many CONFIG_ZONE_xxx usage.
[2/2] .... make ZONE_MOVABLE configurable.


This patch set is against 2.6.23-rc3-mm1. tested on i386/UP and ia64/NUMA

If I should wait for a while (until vm setteled down), I'll wait.

Regards,
-Kame

-

From: KAMEZAWA Hiroyuki
Date: Friday, August 31, 2007 - 3:13 am

zone_ifdef_cleanup_by_renumbering.patch

Now, this patch defines zone_idx for not-configured-zones.
like 
	enum_zone_type {
		(ZONE_DMA configured)
		(ZONE_DMA32 configured)
		ZONE_NORMAL
		(ZONE_HIGHMEM configured)
		ZONE_MOVABLE
		MAX_NR_ZONES,
		(ZONE_DMA not-configured)
		(ZONE_DMA32 not-configured)
		(ZONE_HIGHMEM not-configured)
	};

By this, we can determine zone is configured or not by

	zone_idx < MAX_NR_ZONES.

We can avoid #ifdef for CONFIG_ZONE_xxx to some extent.

This patch also replaces CONFIG_ZONE_DMA_FLAG by is_configured_zone(ZONE_DMA).

Changelog: v2 -> v3
	- updated against 2.6.23-rc3-mm1.
Changelog: v1 -> v2
	- rebased to 2.6.23-rc1
	- Removed MAX_POSSIBLE_ZONES
	- Added comments

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

 include/linux/gfp.h    |   18 ++++-------
 include/linux/mmzone.h |   79 ++++++++++++++++++++++++++++++-------------------
 include/linux/vmstat.h |   24 +++++++-------
 mm/Kconfig             |    5 ---
 mm/page-writeback.c    |    7 +---
 mm/page_alloc.c        |   33 ++++++++------------
 mm/slab.c              |    4 +-
 7 files changed, 87 insertions(+), 83 deletions(-)

Index: devel-2.6.23-rc3-mm1/include/linux/mmzone.h
===================================================================
--- devel-2.6.23-rc3-mm1.orig/include/linux/mmzone.h
+++ devel-2.6.23-rc3-mm1/include/linux/mmzone.h
@@ -178,10 +178,36 @@ enum zone_type {
 	ZONE_HIGHMEM,
 #endif
 	ZONE_MOVABLE,
-	MAX_NR_ZONES
+	MAX_NR_ZONES,
+#ifndef CONFIG_ZONE_DMA
+	ZONE_DMA,
+#endif
+#ifndef CONFIG_ZONE_DMA32
+	ZONE_DMA32,
+#endif
+#ifndef CONFIG_HIGHMEM
+	ZONE_HIGHMEM,
+#endif
 };
 
 /*
+ * Test zone type is configured or not.
+ * You can use this function for avoiding #ifdef.
+ *
+ * #ifdef CONFIG_ZONE_DMA
+ *	do_something...
+ * #endif
+ * can be written as
+ * if (is_configured_zone(ZONE_DMA)) {
+ *	do_something..
+ * }
+ */
+static inline int is_configured_zone(enum zone_type zoneidx)
+{
+	return ...
From: Mel Gorman
Date: Thursday, September 6, 2007 - 7:14 am

I like this patchset in general. No immediate problems are jumping out
at me as to why this would be delayed unless it is known to have

This part here means that we always store the strings for zones whether
they are configured or not. I don't think it's worth getting worried
about. Is it worth marking it __read_mostly while you are altering the

I haven't tested it but it looks ok so;

Acked-by: Mel Gorman <mel@csn.ul.ie>

I'll test it early next week when I'm back properly online.

-

From: KAMEZAWA Hiroyuki
Date: Friday, August 31, 2007 - 3:14 am

Makes ZONE_MOVABLE as configurable

Based on "zone_ifdef_cleanup_by_renumbering.patch"

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>



Index: devel-2.6.23-rc3-mm1/include/linux/mmzone.h
===================================================================
--- devel-2.6.23-rc3-mm1.orig/include/linux/mmzone.h
+++ devel-2.6.23-rc3-mm1/include/linux/mmzone.h
@@ -177,7 +177,9 @@ enum zone_type {
 	 */
 	ZONE_HIGHMEM,
 #endif
+#ifdef CONFIG_ZONE_MOVABLE
 	ZONE_MOVABLE,
+#endif
 	MAX_NR_ZONES,
 #ifndef CONFIG_ZONE_DMA
 	ZONE_DMA,
@@ -188,6 +190,9 @@ enum zone_type {
 #ifndef CONFIG_HIGHMEM
 	ZONE_HIGHMEM,
 #endif
+#ifndef CONFIG_ZONE_MOVABLE
+	ZONE_MOVABLE,
+#endif
 };
 
 /*
@@ -612,11 +617,13 @@ static inline int zone_idx_is(enum zone_
 
 static inline int zone_movable_is_highmem(void)
 {
-#if CONFIG_ARCH_POPULATES_NODE_MAP
-	if (is_configured_zone(ZONE_HIGHMEM))
-		return movable_zone == ZONE_HIGHMEM;
-#endif
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+	return is_configured_zone(ZONE_HIGHMEM) &&
+	       is_configured_zone(ZONE_MOVABLE) &&
+		(movable_zone == ZONE_HIGHMEM);
+#else
 	return 0;
+#endif
 }
 
 static inline int is_highmem_idx(enum zone_type idx)
Index: devel-2.6.23-rc3-mm1/include/linux/gfp.h
===================================================================
--- devel-2.6.23-rc3-mm1.orig/include/linux/gfp.h
+++ devel-2.6.23-rc3-mm1/include/linux/gfp.h
@@ -130,7 +130,8 @@ static inline enum zone_type gfp_zone(gf
 	if (is_configured_zone(ZONE_DMA32) && (flags & __GFP_DMA32))
 		return base + ZONE_DMA32;
 
-	if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
+	if (is_configured_zone(ZONE_MOVABLE) &&
+	    (flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
 			(__GFP_HIGHMEM | __GFP_MOVABLE))
 		return base + ZONE_MOVABLE;
 
Index: devel-2.6.23-rc3-mm1/mm/Kconfig
===================================================================
--- devel-2.6.23-rc3-mm1.orig/mm/Kconfig
+++ devel-2.6.23-rc3-mm1/mm/Kconfig
@@ -125,6 +125,18 @@ ...
From: Mel Gorman
Date: Thursday, September 6, 2007 - 7:16 am

Again, looks ok. Will test it early next week. We shouldn't forget that

-

From: Andrew Morton
Date: Monday, September 17, 2007 - 7:47 pm

This patch causes my old dual-pIII machine to instantly reboot: 0.000001 seconds
uptime.

http://userweb.kernel.org/~akpm/config-vmm.txt
-

From: KAMEZAWA Hiroyuki
Date: Monday, September 17, 2007 - 8:02 pm

On Mon, 17 Sep 2007 19:47:48 -0700

Ok, will find problem.

Thanks,
-Kame

-

Previous thread: PROBLEM: kernel 2.6.22.6 pata_pdc202xx_old.c limiting to UDMA/33 instead of UDMA/100 (UPDATED 2.6.22.6) by n on Friday, August 31, 2007 - 2:04 am. (1 message)

Next thread: [RFC][PATCH 0/6] An IPC implementation base on Linux IDRs by Nadia.Derbey on Friday, August 31, 2007 - 4:24 am. (1 message)