diff options
Diffstat (limited to 'include/linux/gfp.h')
| -rw-r--r-- | include/linux/gfp.h | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index cc9e60844484..bf2b6bc3f6fd 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -9,17 +9,16 @@ struct vm_area_struct; | |||
| 9 | 9 | ||
| 10 | /* | 10 | /* |
| 11 | * GFP bitmasks.. | 11 | * GFP bitmasks.. |
| 12 | * | ||
| 13 | * Zone modifiers (see linux/mmzone.h - low three bits) | ||
| 14 | * | ||
| 15 | * Do not put any conditional on these. If necessary modify the definitions | ||
| 16 | * without the underscores and use the consistently. The definitions here may | ||
| 17 | * be used in bit comparisons. | ||
| 12 | */ | 18 | */ |
| 13 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */ | ||
| 14 | #define __GFP_DMA ((__force gfp_t)0x01u) | 19 | #define __GFP_DMA ((__force gfp_t)0x01u) |
| 15 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) | 20 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) |
| 16 | #ifdef CONFIG_DMA_IS_DMA32 | 21 | #define __GFP_DMA32 ((__force gfp_t)0x04u) |
| 17 | #define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */ | ||
| 18 | #elif BITS_PER_LONG < 64 | ||
| 19 | #define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */ | ||
| 20 | #else | ||
| 21 | #define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */ | ||
| 22 | #endif | ||
| 23 | 22 | ||
| 24 | /* | 23 | /* |
| 25 | * Action modifiers - doesn't change the zoning | 24 | * Action modifiers - doesn't change the zoning |
| @@ -46,6 +45,7 @@ struct vm_area_struct; | |||
| 46 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ | 45 | #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ |
| 47 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ | 46 | #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ |
| 48 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ | 47 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ |
| 48 | #define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ | ||
| 49 | 49 | ||
| 50 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ | 50 | #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ |
| 51 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) | 51 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) |
| @@ -54,7 +54,7 @@ struct vm_area_struct; | |||
| 54 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ | 54 | #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ |
| 55 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ | 55 | __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ |
| 56 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ | 56 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ |
| 57 | __GFP_NOMEMALLOC|__GFP_HARDWALL) | 57 | __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE) |
| 58 | 58 | ||
| 59 | /* This equals 0, but use constants in case they ever change */ | 59 | /* This equals 0, but use constants in case they ever change */ |
| 60 | #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) | 60 | #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) |
| @@ -67,6 +67,13 @@ struct vm_area_struct; | |||
| 67 | #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ | 67 | #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ |
| 68 | __GFP_HIGHMEM) | 68 | __GFP_HIGHMEM) |
| 69 | 69 | ||
| 70 | #ifdef CONFIG_NUMA | ||
| 71 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | ||
| 72 | #else | ||
| 73 | #define GFP_THISNODE 0 | ||
| 74 | #endif | ||
| 75 | |||
| 76 | |||
| 70 | /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some | 77 | /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some |
| 71 | platforms, used as appropriate on others */ | 78 | platforms, used as appropriate on others */ |
| 72 | 79 | ||
| @@ -76,11 +83,19 @@ struct vm_area_struct; | |||
| 76 | #define GFP_DMA32 __GFP_DMA32 | 83 | #define GFP_DMA32 __GFP_DMA32 |
| 77 | 84 | ||
| 78 | 85 | ||
| 79 | static inline int gfp_zone(gfp_t gfp) | 86 | static inline enum zone_type gfp_zone(gfp_t flags) |
| 80 | { | 87 | { |
| 81 | int zone = GFP_ZONEMASK & (__force int) gfp; | 88 | if (flags & __GFP_DMA) |
| 82 | BUG_ON(zone >= GFP_ZONETYPES); | 89 | return ZONE_DMA; |
| 83 | return zone; | 90 | #ifdef CONFIG_ZONE_DMA32 |
| 91 | if (flags & __GFP_DMA32) | ||
| 92 | return ZONE_DMA32; | ||
| 93 | #endif | ||
| 94 | #ifdef CONFIG_HIGHMEM | ||
| 95 | if (flags & __GFP_HIGHMEM) | ||
| 96 | return ZONE_HIGHMEM; | ||
| 97 | #endif | ||
| 98 | return ZONE_NORMAL; | ||
| 84 | } | 99 | } |
| 85 | 100 | ||
| 86 | /* | 101 | /* |
