linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] GFP_ZONEMASK vs. MAX_NR_ZONES
@ 2003-03-18  1:53 Matthew Dobson
  2003-03-18  2:54 ` William Lee Irwin III
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Dobson @ 2003-03-18  1:53 UTC (permalink / raw)
  To: Andrew Morton, Martin J. Bligh, William Lee Irwin III, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

Ok...  hot on the heels of the other GFP_ZONEMASK patch:

struct bootmem_data;
typedef struct pglist_data {
	struct zone node_zones[MAX_NR_ZONES];
	struct zonelist node_zonelists[GFP_ZONEMASK+1];
	int nr_zones;
	struct page *node_mem_map;
	unsigned long *valid_addr_bitmap;
	struct bootmem_data *bdata;
	unsigned long node_start_pfn;
	unsigned long node_size;
	int node_id;
	struct pglist_data *pgdat_next;
	wait_queue_head_t       kswapd_wait;
} pg_data_t;

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

[-- Attachment #2: zonelist_fix-2.5.65.patch --]
[-- Type: text/plain, Size: 1105 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/include/linux/mmzone.h linux-2.5.64-zonelist_fix/include/linux/mmzone.h
--- linux-2.5.64-vanilla/include/linux/mmzone.h	Tue Mar  4 19:29:22 2003
+++ linux-2.5.64-zonelist_fix/include/linux/mmzone.h	Mon Mar 17 14:13:02 2003
@@ -178,7 +178,7 @@
 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 -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/mm/page_alloc.c linux-2.5.64-zonelist_fix/mm/page_alloc.c
--- linux-2.5.64-vanilla/mm/page_alloc.c	Tue Mar  4 19:28:58 2003
+++ linux-2.5.64-zonelist_fix/mm/page_alloc.c	Mon Mar 17 14:13:02 2003
@@ -1028,7 +1028,7 @@
 
 	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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] GFP_ZONEMASK vs. MAX_NR_ZONES
  2003-03-18  1:53 [patch] GFP_ZONEMASK vs. MAX_NR_ZONES Matthew Dobson
@ 2003-03-18  2:54 ` William Lee Irwin III
  0 siblings, 0 replies; 2+ messages in thread
From: William Lee Irwin III @ 2003-03-18  2:54 UTC (permalink / raw)
  To: Matthew Dobson; +Cc: Andrew Morton, Martin J. Bligh, linux-kernel

On Mon, Mar 17, 2003 at 05:53:08PM -0800, Matthew Dobson wrote:
> 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?

No, you're not crazy, you're right:

#define __GFP_DMA       0x01
#define __GFP_HIGHMEM   0x02

/* Action modifiers - doesn't change the zoning */
#define __GFP_WAIT      0x10    /* Can wait and reschedule? */
#define __GFP_HIGH      0x20    /* Should access emergency pools? */
#define __GFP_IO        0x40    /* Can start physical IO? */
#define __GFP_FS        0x80    /* Can call down to low-level FS? */
#define __GFP_COLD      0x100   /* Cache-cold page required */
#define __GFP_NOWARN    0x200   /* Suppress page allocation failure warning */

bits 3-6 of gfp masks are totally unused.


-- wli

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-18  2:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-18  1:53 [patch] GFP_ZONEMASK vs. MAX_NR_ZONES Matthew Dobson
2003-03-18  2:54 ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).