Skip to contentSkip to conversation

x86, mm: Make init_mem_mapping be able to be called several times

PATCH New Yinghai Lu 1 participant 1 message Apr 12, 2013

Subsystems (2)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH v4 21/22 x86, mm: Make init_mem_mapping be able to be called several times

Prepare to put page table on local nodes.

Move calling of init_mem_mapping to early_initmem_init.

Rework alloc_low_pages to alloc page table in following order:
BRK, local node, low range

update: remove two lines in changelog about xen.

Cc Pekka Enberg <[email protected]>
Cc Jacob Shin <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
---
 arch/x86/include/asm/pgtable.h |  2 +-
 arch/x86/kernel/setup.c        |  1 -
 arch/x86/mm/init.c             | 88 ++++++++++++++++++++++++++----------------
 arch/x86/mm/numa.c             | 24 ++++++++++++
 4 files changed, 79 insertions(+), 36 deletions(-)
arch/x86/include/asm/pgtable.h +1 -1
index 1e67223..868687c 100644
@@ -621,7 +621,7 @@ static inline int pgd_none(pgd_t pgd)
 #ifndef __ASSEMBLY__
 
 extern int direct_gbpages;
-void init_mem_mapping(void);
+void init_mem_mapping(unsigned long begin, unsigned long end);
 void early_alloc_pgt_buf(void);
 
 /* local pte updates need not use xchg for locking */
arch/x86/kernel/setup.c +0 -1
index 6ef3fa2..67ef4bc 100644
@@ -1105,7 +1105,6 @@ void __init setup_arch(char **cmdline_p)
 	acpi_boot_table_init();
 	early_acpi_boot_init();
 	early_initmem_init();
-	init_mem_mapping();
 	memblock.current_limit = get_max_mapped();
 	early_trap_pf_init();
 
arch/x86/mm/init.c +54 -34

142 lines not on this page · raw message

arch/x86/mm/numa.c +24 -0
index c2d4653..d3eb0c9 100644
@@ -17,8 +17,10 @@
 #include <asm/dma.h>
 #include <asm/acpi.h>
 #include <asm/amd_nb.h>
+#include <asm/tlbflush.h>
 
 #include "numa_internal.h"
+#include "mm_internal.h"
 
 int __initdata numa_off;
 nodemask_t numa_nodes_parsed __initdata;
@@ -668,9 +670,31 @@ static void __init early_x86_numa_init(void)
 	numa_init(dummy_numa_init);
 }
 
+#ifdef CONFIG_X86_64
+static void __init early_x86_numa_init_mapping(void)
+{
+	init_mem_mapping(0, max_pfn << PAGE_SHIFT);
+	if (max_pfn > max_low_pfn)
+		max_low_pfn = max_pfn;
+}
+#else
+static void __init early_x86_numa_init_mapping(void)
+{
+	init_mem_mapping(0, max_low_pfn << PAGE_SHIFT);
+	early_ioremap_page_table_range_init();
+}
+#endif
+
 void __init early_initmem_init(void)
 {
 	early_x86_numa_init();
+
+	early_x86_numa_init_mapping();
+
+	load_cr3(swapper_pg_dir);
+	__flush_tlb_all();
+
+	early_memtest(0, max_pfn_mapped<<PAGE_SHIFT);
 }
 
 void __init x86_numa_init(void)
Signature · 1 line
1.8.1.4