提交 76c32418 编写于 作者: Y Yinghai Lu 提交者: Ingo Molnar

x86: fix trim mtrr not to setup_memory two times

we could call find_max_pfn() directly instead of setup_memory() to get
max_pfn needed for mtrr trimming.

otherwise setup_memory() is called two times... that is duplicated...

[ mingo@elte.hu: both Thomas and me simulated a double call to
  setup_bootmem_allocator() and can confirm that it is a real bug
  which can hang in certain configs. It's not been reported yet but
  that is probably due to the relatively scarce nature of
  MTRR-trimming systems. ]
Signed-off-by: NYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 923a0cf8
...@@ -406,8 +406,6 @@ static unsigned long __init setup_memory(void) ...@@ -406,8 +406,6 @@ static unsigned long __init setup_memory(void)
*/ */
min_low_pfn = PFN_UP(init_pg_tables_end); min_low_pfn = PFN_UP(init_pg_tables_end);
find_max_pfn();
max_low_pfn = find_max_low_pfn(); max_low_pfn = find_max_low_pfn();
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
...@@ -764,11 +762,12 @@ void __init setup_arch(char **cmdline_p) ...@@ -764,11 +762,12 @@ void __init setup_arch(char **cmdline_p)
if (efi_enabled) if (efi_enabled)
efi_init(); efi_init();
max_low_pfn = setup_memory();
/* update e820 for memory not covered by WB MTRRs */ /* update e820 for memory not covered by WB MTRRs */
find_max_pfn();
mtrr_bp_init(); mtrr_bp_init();
if (mtrr_trim_uncached_memory(max_pfn)) if (mtrr_trim_uncached_memory(max_pfn))
find_max_pfn();
max_low_pfn = setup_memory(); max_low_pfn = setup_memory();
#ifdef CONFIG_VMI #ifdef CONFIG_VMI
......
...@@ -324,7 +324,6 @@ unsigned long __init setup_memory(void) ...@@ -324,7 +324,6 @@ unsigned long __init setup_memory(void)
* this space and use it to adjust the boundary between ZONE_NORMAL * this space and use it to adjust the boundary between ZONE_NORMAL
* and ZONE_HIGHMEM. * and ZONE_HIGHMEM.
*/ */
find_max_pfn();
get_memcfg_numa(); get_memcfg_numa();
kva_pages = calculate_numa_remap_pages(); kva_pages = calculate_numa_remap_pages();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册