linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch:RFC] New zone ZONE_EASY_RECLAIM[3/5]
@ 2005-11-10 10:41 Yasunori Goto
  0 siblings, 0 replies; only message in thread
From: Yasunori Goto @ 2005-11-10 10:41 UTC (permalink / raw)
  To: Linux Hotplug Memory Support, linux-mm; +Cc: Mel Gorman, Nick Piggin

This is changing build_zonelists for new zone.

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

---

Index: new_zone/mm/page_alloc.c
===================================================================
--- new_zone.orig/mm/page_alloc.c	2005-11-08 17:23:24.000000000 +0900
+++ new_zone/mm/page_alloc.c	2005-11-08 17:27:26.000000000 +0900
@@ -1407,6 +1407,10 @@ static int __init build_zonelists_node(p
 		struct zone *zone;
 	default:
 		BUG();
+	case ZONE_EASY_RECLAIM:
+		zone = pgdat->node_zones + ZONE_EASY_RECLAIM;
+		if (zone->present_pages)
+			zonelist->zones[j++] = zone;
 	case ZONE_HIGHMEM:
 		zone = pgdat->node_zones + ZONE_HIGHMEM;
 		if (zone->present_pages) {
@@ -1428,6 +1432,20 @@ static int __init build_zonelists_node(p
 	return j;
 }
 
+static inline int highest_zone(int i)
+{
+	int res = ZONE_NORMAL;
+
+	if (i == fls(__GFP_EASY_RECLAIM))
+		res = ZONE_EASY_RECLAIM;
+	else if(i == fls(__GFP_HIGHMEM))
+		res = ZONE_HIGHMEM;
+	else if(i == fls(__GFP_DMA))
+		res = ZONE_DMA;
+
+	return res;
+}
+
 #ifdef CONFIG_NUMA
 #define MAX_NODE_LOAD (num_online_nodes())
 static int __initdata node_load[MAX_NUMNODES];
@@ -1524,11 +1542,7 @@ static void __init build_zonelists(pg_da
 			zonelist = pgdat->node_zonelists + i;
 			for (j = 0; zonelist->zones[j] != NULL; j++);
 
-			k = ZONE_NORMAL;
-			if (i & __GFP_HIGHMEM)
-				k = ZONE_HIGHMEM;
-			if (i & __GFP_DMA)
-				k = ZONE_DMA;
+			k = highest_zone(i);
 
 	 		j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
 			zonelist->zones[j] = NULL;
@@ -1549,11 +1563,7 @@ static void __init build_zonelists(pg_da
 		zonelist = pgdat->node_zonelists + i;
 
 		j = 0;
-		k = ZONE_NORMAL;
-		if (i & __GFP_HIGHMEM)
-			k = ZONE_HIGHMEM;
-		if (i & __GFP_DMA)
-			k = ZONE_DMA;
+		k = highest_zone(i);
 
  		j = build_zonelists_node(pgdat, zonelist, j, k);
  		/*

-- 
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-10 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-10 10:41 [Patch:RFC] New zone ZONE_EASY_RECLAIM[3/5] Yasunori Goto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox