Skip to contentSkip to conversation

GFP_ZONEMASK fix

PATCH New Matthew Dobson 1 participant 1 message Mar 18, 2003

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

PATCH 1/1 GFP_ZONEMASK fix

GFP_ZONEMASK is set up as 0xf, meaning the low four bits specify the zone type. As there are only 3 zone types (DMA, NORMAL, & HIGHMEM), and only 2 of them (DMA & HIGHMEM) have flags (NORMAL is the default), this is wrong. This simple patch changes one comment, and changes the value of GFP_ZONEMASK from 0xf to 0x3.

I'm not sure if this was specified this way to allow for future expansion, or what. If so, please ignore this. If anyone can tell me why this is set to four bits, I'm all ears.

Cheers!

-Matt

include/linux/gfp.h +1 -1
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/include/linux/gfp.h linux-2.5.64-gfp_zonemask_fix/include/linux/gfp.h
@@ -7,7 +7,7 @@
 /*
  * GFP bitmasks..
  */
-/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low four bits) */
+/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
 #define __GFP_DMA	0x01
 #define __GFP_HIGHMEM	0x02
 
include/linux/mmzone.h +1 -1
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/include/linux/mmzone.h linux-2.5.64-gfp_zonemask_fix/include/linux/mmzone.h
@@ -162,7 +162,7 @@
 	struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
 };
 
-#define GFP_ZONEMASK	0x0f
+#define GFP_ZONEMASK	0x03
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM