shrink zonelists.

davej@codemonkey.org.uk
Thu, 15 May 2003 04:31:16 +0100


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

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/mmzone.h linux-2.5/include/linux/mmzone.h
--- bk-linus/include/linux/mmzone.h 2003-04-10 06:01:37.000000000 +0100
+++ linux-2.5/include/linux/mmzone.h 2003-04-22 17:33:54.000000000 +0100
@@ -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;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/page_alloc.c linux-2.5/mm/page_alloc.c
--- bk-linus/mm/page_alloc.c 2003-05-13 11:51:13.000000000 +0100
+++ linux-2.5/mm/page_alloc.c 2003-05-13 11:59:33.000000000 +0100
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/