Skip to contentSkip to conversation

New zone ZONE_EASY_RECLAIM[3/5]

Patch:RFC Yasunori Goto 1 participant 1 message Nov 10, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is changing build_zonelists for new zone.

---

mm/page_alloc.c +20 -10
Index: new_zone/mm/page_alloc.c
===================================================================
@@ -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);
  		/*
Signature · 8 lines
Yasunori Goto 


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