aboutsummaryrefslogtreecommitdiff
path: root/include/linux/gfp.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-22 19:39:30 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-22 19:39:30 -0800
commitac3461ad632e86e7debd871776683c05ef3ba4c6 (patch)
tree98ea9272b3e9d05499f1a4fbf10e998f6d476fa5 /include/linux/gfp.h
parent4b4a27dff4e2d4cc2eac1cde31aede834a966a48 (diff)
Fix up GFP_ZONEMASK for GFP_DMA32 usage
There was some confusion about the different zone usage, this should fix up the resulting mess in the GFP zonemask handling. The different zone usage is still confusing (it's very easy to mix up the individual zone numbers with the GFP zone _list_ numbers), so we might want to clean up some of this in the future, but in the meantime this should fix the actual problems. Acked-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/gfp.h')
-rw-r--r--include/linux/gfp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 313dfe9b443..8b2eab90abb 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -11,7 +11,7 @@ struct vm_area_struct;
/*
* GFP bitmasks..
*/
-/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
+/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
#define __GFP_DMA ((__force gfp_t)0x01u)
#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
#ifdef CONFIG_DMA_IS_DMA32
@@ -74,7 +74,12 @@ struct vm_area_struct;
#define GFP_DMA32 __GFP_DMA32
-#define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK))
+static inline int gfp_zone(gfp_t gfp)
+{
+ int zone = GFP_ZONEMASK & (__force int) gfp;
+ BUG_ON(zone >= GFP_ZONETYPES);
+ return zone;
+}
/*
* There is only one page-allocator function, and two main namespaces to