diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-03 22:32:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-04 06:01:55 -0400 |
commit | 84b56fa46b36c2df508e7d421feab514fad30f81 (patch) | |
tree | 818334f7f9af6c6354a37d5a13b12ac754a1c63f /arch/x86/mm/discontig_32.c | |
parent | ab530e1f781da4d704892daab2bdd568f473687d (diff) |
x86, numa, 32-bit: make sure get we kva space
when 1/3 user/kernel split is used, and less memory is installed, or if
we have a big hole below 4g, max_low_pfn is still using 3g-128m
try to go down from max_low_pfn until we get it. otherwise will panic.
need to make 32-bit code to use register_e820_active_regions ... later.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/discontig_32.c')
-rw-r--r-- | arch/x86/mm/discontig_32.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c index 914a81ee7855..7ced26ab9aec 100644 --- a/arch/x86/mm/discontig_32.c +++ b/arch/x86/mm/discontig_32.c | |||
@@ -328,6 +328,7 @@ unsigned long __init setup_memory(void) | |||
328 | { | 328 | { |
329 | int nid; | 329 | int nid; |
330 | unsigned long system_start_pfn, system_max_low_pfn; | 330 | unsigned long system_start_pfn, system_max_low_pfn; |
331 | long kva_target_pfn; | ||
331 | 332 | ||
332 | /* | 333 | /* |
333 | * When mapping a NUMA machine we allocate the node_mem_map arrays | 334 | * When mapping a NUMA machine we allocate the node_mem_map arrays |
@@ -344,11 +345,17 @@ unsigned long __init setup_memory(void) | |||
344 | system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end); | 345 | system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end); |
345 | 346 | ||
346 | system_max_low_pfn = max_low_pfn = find_max_low_pfn(); | 347 | system_max_low_pfn = max_low_pfn = find_max_low_pfn(); |
347 | kva_start_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); | 348 | kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); |
348 | kva_start_pfn = find_e820_area(kva_start_pfn<<PAGE_SHIFT, | 349 | do { |
349 | max_low_pfn<<PAGE_SHIFT, | 350 | kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT, |
350 | kva_pages<<PAGE_SHIFT, | 351 | max_low_pfn<<PAGE_SHIFT, |
351 | PTRS_PER_PTE<<PAGE_SHIFT) >> PAGE_SHIFT; | 352 | kva_pages<<PAGE_SHIFT, |
353 | PTRS_PER_PTE<<PAGE_SHIFT) >> PAGE_SHIFT; | ||
354 | kva_target_pfn -= PTRS_PER_PTE; | ||
355 | } while (kva_start_pfn == -1UL && kva_target_pfn > min_low_pfn); | ||
356 | |||
357 | if (kva_start_pfn == -1UL) | ||
358 | panic("Can not get kva space\n"); | ||
352 | 359 | ||
353 | printk("kva_start_pfn ~ %ld find_max_low_pfn() ~ %ld\n", | 360 | printk("kva_start_pfn ~ %ld find_max_low_pfn() ~ %ld\n", |
354 | kva_start_pfn, max_low_pfn); | 361 | kva_start_pfn, max_low_pfn); |