diff options
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 76d33e688593..7fe317164b73 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -137,60 +137,18 @@ enum zone_type { | |||
137 | MAX_NR_ZONES | 137 | MAX_NR_ZONES |
138 | }; | 138 | }; |
139 | 139 | ||
140 | |||
141 | /* | 140 | /* |
142 | * When a memory allocation must conform to specific limitations (such | 141 | * When a memory allocation must conform to specific limitations (such |
143 | * as being suitable for DMA) the caller will pass in hints to the | 142 | * as being suitable for DMA) the caller will pass in hints to the |
144 | * allocator in the gfp_mask, in the zone modifier bits. These bits | 143 | * allocator in the gfp_mask, in the zone modifier bits. These bits |
145 | * are used to select a priority ordered list of memory zones which | 144 | * are used to select a priority ordered list of memory zones which |
146 | * match the requested limits. GFP_ZONEMASK defines which bits within | 145 | * match the requested limits. See gfp_zone() in include/linux/gfp.h |
147 | * the gfp_mask should be considered as zone modifiers. Each valid | ||
148 | * combination of the zone modifier bits has a corresponding list | ||
149 | * of zones (in node_zonelists). Thus for two zone modifiers there | ||
150 | * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will | ||
151 | * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible | ||
152 | * combinations of zone modifiers in "zone modifier space". | ||
153 | * | ||
154 | * As an optimisation any zone modifier bits which are only valid when | ||
155 | * no other zone modifier bits are set (loners) should be placed in | ||
156 | * the highest order bits of this field. This allows us to reduce the | ||
157 | * extent of the zonelists thus saving space. For example in the case | ||
158 | * of three zone modifier bits, we could require up to eight zonelists. | ||
159 | * If the left most zone modifier is a "loner" then the highest valid | ||
160 | * zonelist would be four allowing us to allocate only five zonelists. | ||
161 | * Use the first form for GFP_ZONETYPES when the left most bit is not | ||
162 | * a "loner", otherwise use the second. | ||
163 | * | ||
164 | * NOTE! Make sure this matches the zones in <linux/gfp.h> | ||
165 | */ | 146 | */ |
166 | 147 | ||
167 | #ifdef CONFIG_ZONE_DMA32 | 148 | #if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM) |
168 | 149 | #define ZONES_SHIFT 1 | |
169 | #ifdef CONFIG_HIGHMEM | ||
170 | #define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */ | ||
171 | #define GFP_ZONEMASK 0x07 | ||
172 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ | ||
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 | |||
183 | #define GFP_ZONEMASK 0x03 | ||
184 | #define ZONES_SHIFT 2 | ||
185 | #define GFP_ZONETYPES 3 | ||
186 | |||
187 | #else | 150 | #else |
188 | 151 | #define ZONES_SHIFT 2 | |
189 | #define GFP_ZONEMASK 0x01 | ||
190 | #define ZONES_SHIFT 1 | ||
191 | #define GFP_ZONETYPES 2 | ||
192 | |||
193 | #endif | ||
194 | #endif | 152 | #endif |
195 | 153 | ||
196 | struct zone { | 154 | struct zone { |
@@ -360,7 +318,7 @@ struct zonelist { | |||
360 | struct bootmem_data; | 318 | struct bootmem_data; |
361 | typedef struct pglist_data { | 319 | typedef struct pglist_data { |
362 | struct zone node_zones[MAX_NR_ZONES]; | 320 | struct zone node_zones[MAX_NR_ZONES]; |
363 | struct zonelist node_zonelists[GFP_ZONETYPES]; | 321 | struct zonelist node_zonelists[MAX_NR_ZONES]; |
364 | int nr_zones; | 322 | int nr_zones; |
365 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | 323 | #ifdef CONFIG_FLAT_NODE_MEM_MAP |
366 | struct page *node_mem_map; | 324 | struct page *node_mem_map; |