diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-13 22:08:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 04:36:29 -0400 |
commit | cc1050bafebfb1d7935331282e948b5016318192 (patch) | |
tree | 7e9e6935ed4a18afb63dedbcd808657c683265f5 /arch/x86 | |
parent | d2dbf343329dc777d77488743465f7be4245971d (diff) |
x86: replace shrink_active_range() with remove_active_range()
in case we have kva before ramdisk on a node, we still need to use
those ranges.
v2: reserve_early kva ram area, in case there are holes in highmem, to avoid
those area could be treat as free high pages.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/discontig_32.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c index accc7c6c57fc..c3f119e99e0d 100644 --- a/arch/x86/mm/discontig_32.c +++ b/arch/x86/mm/discontig_32.c | |||
@@ -230,8 +230,8 @@ static unsigned long calculate_numa_remap_pages(void) | |||
230 | unsigned long size, reserve_pages = 0; | 230 | unsigned long size, reserve_pages = 0; |
231 | 231 | ||
232 | for_each_online_node(nid) { | 232 | for_each_online_node(nid) { |
233 | u64 node_end_target; | 233 | u64 node_kva_target; |
234 | u64 node_end_final; | 234 | u64 node_kva_final; |
235 | 235 | ||
236 | /* | 236 | /* |
237 | * The acpi/srat node info can show hot-add memroy zones | 237 | * The acpi/srat node info can show hot-add memroy zones |
@@ -254,42 +254,45 @@ static unsigned long calculate_numa_remap_pages(void) | |||
254 | /* now the roundup is correct, convert to PAGE_SIZE pages */ | 254 | /* now the roundup is correct, convert to PAGE_SIZE pages */ |
255 | size = size * PTRS_PER_PTE; | 255 | size = size * PTRS_PER_PTE; |
256 | 256 | ||
257 | node_end_target = round_down(node_end_pfn[nid] - size, | 257 | node_kva_target = round_down(node_end_pfn[nid] - size, |
258 | PTRS_PER_PTE); | 258 | PTRS_PER_PTE); |
259 | node_end_target <<= PAGE_SHIFT; | 259 | node_kva_target <<= PAGE_SHIFT; |
260 | do { | 260 | do { |
261 | node_end_final = find_e820_area(node_end_target, | 261 | node_kva_final = find_e820_area(node_kva_target, |
262 | ((u64)node_end_pfn[nid])<<PAGE_SHIFT, | 262 | ((u64)node_end_pfn[nid])<<PAGE_SHIFT, |
263 | ((u64)size)<<PAGE_SHIFT, | 263 | ((u64)size)<<PAGE_SHIFT, |
264 | LARGE_PAGE_BYTES); | 264 | LARGE_PAGE_BYTES); |
265 | node_end_target -= LARGE_PAGE_BYTES; | 265 | node_kva_target -= LARGE_PAGE_BYTES; |
266 | } while (node_end_final == -1ULL && | 266 | } while (node_kva_final == -1ULL && |
267 | (node_end_target>>PAGE_SHIFT) > (node_start_pfn[nid])); | 267 | (node_kva_target>>PAGE_SHIFT) > (node_start_pfn[nid])); |
268 | 268 | ||
269 | if (node_end_final == -1ULL) | 269 | if (node_kva_final == -1ULL) |
270 | panic("Can not get kva ram\n"); | 270 | panic("Can not get kva ram\n"); |
271 | 271 | ||
272 | printk("Reserving %ld pages of KVA for lmem_map of node %d\n", | ||
273 | size, nid); | ||
274 | node_remap_size[nid] = size; | 272 | node_remap_size[nid] = size; |
275 | node_remap_offset[nid] = reserve_pages; | 273 | node_remap_offset[nid] = reserve_pages; |
276 | reserve_pages += size; | 274 | reserve_pages += size; |
277 | printk("Shrinking node %d from %ld pages to %lld pages\n", | 275 | printk("Reserving %ld pages of KVA for lmem_map of node %d at %llx\n", |
278 | nid, node_end_pfn[nid], node_end_final>>PAGE_SHIFT); | 276 | size, nid, node_kva_final>>PAGE_SHIFT); |
279 | 277 | ||
280 | /* | 278 | /* |
281 | * prevent kva address below max_low_pfn want it on system | 279 | * prevent kva address below max_low_pfn want it on system |
282 | * with less memory later. | 280 | * with less memory later. |
283 | * layout will be: KVA address , KVA RAM | 281 | * layout will be: KVA address , KVA RAM |
282 | * | ||
283 | * we are supposed to only record the one less then max_low_pfn | ||
284 | * but we could have some hole in high memory, and it will only | ||
285 | * check page_is_ram(pfn) && !page_is_reserved_early(pfn) to decide | ||
286 | * to use it as free. | ||
287 | * So reserve_early here, hope we don't run out of that array | ||
284 | */ | 288 | */ |
285 | if ((node_end_final>>PAGE_SHIFT) < max_low_pfn) | 289 | reserve_early(node_kva_final, |
286 | reserve_early(node_end_final, | 290 | node_kva_final+(((u64)size)<<PAGE_SHIFT), |
287 | node_end_final+(((u64)size)<<PAGE_SHIFT), | 291 | "KVA RAM"); |
288 | "KVA RAM"); | 292 | |
289 | 293 | node_remap_start_pfn[nid] = node_kva_final>>PAGE_SHIFT; | |
290 | node_end_pfn[nid] = node_end_final>>PAGE_SHIFT; | 294 | remove_active_range(nid, node_remap_start_pfn[nid], |
291 | node_remap_start_pfn[nid] = node_end_pfn[nid]; | 295 | node_remap_start_pfn[nid] + size); |
292 | shrink_active_range(nid, node_end_pfn[nid]); | ||
293 | } | 296 | } |
294 | printk("Reserving total of %ld pages for numa KVA remap\n", | 297 | printk("Reserving total of %ld pages for numa KVA remap\n", |
295 | reserve_pages); | 298 | reserve_pages); |