Skip to contentSkip to conversation

x86: unify 64-bit UMA and NUMA paging_init()

PATCH In review Pekka Enberg 1 participant 2 messages May 7, 2009 – May 11, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: unify 64-bit UMA and NUMA paging_init()

From: Pekka Enberg <[email protected]>

64-bit UMA and NUMA versions of paging_init() are almost identical. Therefore, merge the copy in mm/numa_64.c to mm/init_64.c to remove duplicate code.

[ Impact: cleanup ]

---
 arch/x86/mm/init_64.c |    6 +++++-
 arch/x86/mm/numa_64.c |   15 ---------------
 2 files changed, 5 insertions(+), 16 deletions(-)
arch/x86/mm/init_64.c +5 -1
index 1753e80..ccc0e6e 100644
@@ -628,6 +628,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn)
 	early_res_to_bootmem(0, end_pfn<<PAGE_SHIFT);
 	reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
 }
+#endif
 
 void __init paging_init(void)
 {
@@ -638,11 +639,14 @@ void __init paging_init(void)
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 
+#ifdef CONFIG_NUMA
+	sparse_memory_present_with_active_regions(MAX_NUMNODES);
+#else
 	memory_present(0, 0, max_pfn);
+#endif
 	sparse_init();
 	free_area_init_nodes(max_zone_pfns);
 }
-#endif
 
 /*
  * Memory hotplug specific functions
arch/x86/mm/numa_64.c +0 -15
index d73aaa8..b816922 100644
@@ -575,21 +575,6 @@ unsigned long __init numa_free_all_bootmem(void)
 	return pages;
 }
 
-void __init paging_init(void)
-{
-	unsigned long max_zone_pfns[MAX_NR_ZONES];
-
-	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
-	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
-	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
-	max_zone_pfns[ZONE_NORMAL] = max_pfn;
-
-	sparse_memory_present_with_active_regions(MAX_NUMNODES);
-	sparse_init();
-
-	free_area_init_nodes(max_zone_pfns);
-}
-
 static __init int numa_setup(char *opt)
 {
 	if (!opt)
Signature · 1 line
1.5.6.3
#1 lore raw
Commit-ID:  3551f88f6439cf4da3f5a3747b320280e30500de
Gitweb:     http://git.kernel.org/tip/3551f88f6439cf4da3f5a3747b320280e30500de
Author:     Pekka Enberg <[email protected]>
AuthorDate: Thu, 7 May 2009 15:35:41 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 11 May 2009 11:52:06 +0200

x86: unify 64-bit UMA and NUMA paging_init()

64-bit UMA and NUMA versions of paging_init() are almost identical. Therefore, merge the copy in mm/numa_64.c to mm/init_64.c to remove duplicate code.

[ Impact: cleanup ]

LKML-Reference: <1241699741.17846.30.camel@penberg-laptop>

---
 arch/x86/mm/init_64.c |    6 +++++-
 arch/x86/mm/numa_64.c |   15 ---------------
 2 files changed, 5 insertions(+), 16 deletions(-)
arch/x86/mm/init_64.c +5 -1
index 6a1a573..be7e127 100644
@@ -585,6 +585,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn)
 	early_res_to_bootmem(0, end_pfn<<PAGE_SHIFT);
 	reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
 }
+#endif
 
 void __init paging_init(void)
 {
@@ -595,11 +596,14 @@ void __init paging_init(void)
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 
+#ifdef CONFIG_NUMA
+	sparse_memory_present_with_active_regions(MAX_NUMNODES);
+#else
 	memory_present(0, 0, max_pfn);
+#endif
 	sparse_init();
 	free_area_init_nodes(max_zone_pfns);
 }
-#endif
 
 /*
  * Memory hotplug specific functions
arch/x86/mm/numa_64.c +0 -15
index 2d05a12..fb61d81 100644
@@ -578,21 +578,6 @@ unsigned long __init numa_free_all_bootmem(void)
 	return pages;
 }
 
-void __init paging_init(void)
-{
-	unsigned long max_zone_pfns[MAX_NR_ZONES];
-
-	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
-	max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
-	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
-	max_zone_pfns[ZONE_NORMAL] = max_pfn;
-
-	sparse_memory_present_with_active_regions(MAX_NUMNODES);
-	sparse_init();
-
-	free_area_init_nodes(max_zone_pfns);
-}
-
 static __init int numa_setup(char *opt)
 {
 	if (!opt)