diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/gfp.h | 18 | ||||
-rw-r--r-- | include/linux/mmzone.h | 36 |
2 files changed, 43 insertions, 11 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 14610b56c132..2a2153ebfe0b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -9,17 +9,19 @@ 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 | * These may be masked by GFP_ZONEMASK to make allocations with this bit | ||
16 | * set fall back to ZONE_NORMAL. | ||
17 | * | ||
18 | * Do not put any conditional on these. If necessary modify the definitions | ||
19 | * without the underscores and use the consistently. The definitions here may | ||
20 | * be used in bit comparisons. | ||
12 | */ | 21 | */ |
13 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */ | ||
14 | #define __GFP_DMA ((__force gfp_t)0x01u) | 22 | #define __GFP_DMA ((__force gfp_t)0x01u) |
15 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) | 23 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) |
16 | #ifndef CONFIG_ZONE_DMA32 | 24 | #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 | 25 | ||
24 | /* | 26 | /* |
25 | * Action modifiers - doesn't change the zoning | 27 | * Action modifiers - doesn't change the zoning |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index adae3c915938..76d33e688593 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -123,6 +123,7 @@ enum zone_type { | |||
123 | * transfers to all addressable memory. | 123 | * transfers to all addressable memory. |
124 | */ | 124 | */ |
125 | ZONE_NORMAL, | 125 | ZONE_NORMAL, |
126 | #ifdef CONFIG_HIGHMEM | ||
126 | /* | 127 | /* |
127 | * A memory area that is only addressable by the kernel through | 128 | * A memory area that is only addressable by the kernel through |
128 | * mapping portions into its own address space. This is for example | 129 | * mapping portions into its own address space. This is for example |
@@ -132,11 +133,10 @@ enum zone_type { | |||
132 | * access. | 133 | * access. |
133 | */ | 134 | */ |
134 | ZONE_HIGHMEM, | 135 | ZONE_HIGHMEM, |
135 | 136 | #endif | |
136 | MAX_NR_ZONES | 137 | MAX_NR_ZONES |
137 | }; | 138 | }; |
138 | 139 | ||
139 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ | ||
140 | 140 | ||
141 | /* | 141 | /* |
142 | * When a memory allocation must conform to specific limitations (such | 142 | * When a memory allocation must conform to specific limitations (such |
@@ -163,12 +163,34 @@ enum zone_type { | |||
163 | * | 163 | * |
164 | * NOTE! Make sure this matches the zones in <linux/gfp.h> | 164 | * NOTE! Make sure this matches the zones in <linux/gfp.h> |
165 | */ | 165 | */ |
166 | #define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */ | ||
167 | 166 | ||
168 | #ifdef CONFIG_ZONE_DMA32 | 167 | #ifdef CONFIG_ZONE_DMA32 |
168 | |||
169 | #ifdef CONFIG_HIGHMEM | ||
170 | #define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */ | ||
169 | #define GFP_ZONEMASK 0x07 | 171 | #define GFP_ZONEMASK 0x07 |
172 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ | ||
170 | #else | 173 | #else |
174 | #define GFP_ZONETYPES ((0x07 + 1) / 2 + 1) /* Loner */ | ||
175 | /* Mask __GFP_HIGHMEM */ | ||
176 | #define GFP_ZONEMASK 0x05 | ||
177 | #define ZONES_SHIFT 2 | ||
178 | #endif | ||
179 | |||
180 | #else | ||
181 | #ifdef CONFIG_HIGHMEM | ||
182 | |||
171 | #define GFP_ZONEMASK 0x03 | 183 | #define GFP_ZONEMASK 0x03 |
184 | #define ZONES_SHIFT 2 | ||
185 | #define GFP_ZONETYPES 3 | ||
186 | |||
187 | #else | ||
188 | |||
189 | #define GFP_ZONEMASK 0x01 | ||
190 | #define ZONES_SHIFT 1 | ||
191 | #define GFP_ZONETYPES 2 | ||
192 | |||
193 | #endif | ||
172 | #endif | 194 | #endif |
173 | 195 | ||
174 | struct zone { | 196 | struct zone { |
@@ -409,7 +431,11 @@ static inline int populated_zone(struct zone *zone) | |||
409 | 431 | ||
410 | static inline int is_highmem_idx(enum zone_type idx) | 432 | static inline int is_highmem_idx(enum zone_type idx) |
411 | { | 433 | { |
434 | #ifdef CONFIG_HIGHMEM | ||
412 | return (idx == ZONE_HIGHMEM); | 435 | return (idx == ZONE_HIGHMEM); |
436 | #else | ||
437 | return 0; | ||
438 | #endif | ||
413 | } | 439 | } |
414 | 440 | ||
415 | static inline int is_normal_idx(enum zone_type idx) | 441 | static inline int is_normal_idx(enum zone_type idx) |
@@ -425,7 +451,11 @@ static inline int is_normal_idx(enum zone_type idx) | |||
425 | */ | 451 | */ |
426 | static inline int is_highmem(struct zone *zone) | 452 | static inline int is_highmem(struct zone *zone) |
427 | { | 453 | { |
454 | #ifdef CONFIG_HIGHMEM | ||
428 | return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; | 455 | return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; |
456 | #else | ||
457 | return 0; | ||
458 | #endif | ||
429 | } | 459 | } |
430 | 460 | ||
431 | static inline int is_normal(struct zone *zone) | 461 | static inline int is_normal(struct zone *zone) |