Skip to contentSkip to conversation

shrink zonelists.

PATCH [email protected] 1 participant 1 message May 15, 2003

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

Originally from Matt Dobson. I've been running with this for a while in -dj, with no noticable side-effects.

Matt:

node_zonelists looks like it should really be declared of size MAX_NR_ZONES, not GFP_ZONEMASK. GFP_ZONEMASK is currently 15, making node_zonelists an array of 16 elements. The extra zonelists are all just duplicates of the *real* zonelists, namely the first 3 entries. Again, if anyone can explain to me why I'm wrong in my thinking, I'd love to know. There's certainly no way you could bitwise-and something with any combination of the GFP_DMA and GFP_HIGHMEM flags to refer to the 12th zonelist or some such! Or am I crazy?

Cheers!

-Matt

include/linux/mmzone.h +2 -2
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/mmzone.h linux-2.5/include/linux/mmzone.h
@@ -146,6 +146,7 @@ struct zone {
 #define ZONE_NORMAL		1
 #define ZONE_HIGHMEM		2
 #define MAX_NR_ZONES		3
+#define GFP_ZONEMASK	0x03
 
 /*
  * One allocation request operates on a zonelist. A zonelist
@@ -162,7 +163,6 @@ struct zonelist {
 	struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
 };
 
-#define GFP_ZONEMASK	0x0f
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -178,7 +178,7 @@ struct zonelist {
 struct bootmem_data;
 typedef struct pglist_data {
 	struct zone node_zones[MAX_NR_ZONES];
-	struct zonelist node_zonelists[GFP_ZONEMASK+1];
+	struct zonelist node_zonelists[MAX_NR_ZONES];
 	int nr_zones;
 	struct page *node_mem_map;
 	unsigned long *valid_addr_bitmap;
mm/page_alloc.c +1 -1
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/page_alloc.c linux-2.5/mm/page_alloc.c
@@ -1041,7 +1041,7 @@ static void __init build_zonelists(pg_da
 
 	local_node = pgdat->node_id;
 	printk("Building zonelist for node : %d\n", local_node);
-	for (i = 0; i <= GFP_ZONEMASK; i++) {
+	for (i = 0; i < MAX_NR_ZONES; i++) {
 		struct zonelist *zonelist;
 
 		zonelist = pgdat->node_zonelists + i;