Function register_page_bootmem_info_node() is suitably defined for
both HOTPLUG and non-HOTPLUG configurations, so we could call it
from mm core instead of arch specific code. This could simplify
arch implementations.

Signed-off-by: Jiang Liu <jiang....@huawei.com>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: "H. Peter Anvin" <h...@zytor.com>
Cc: x...@kernel.org
Cc: Yasuaki Ishimatsu <isimatu.yasu...@jp.fujitsu.com>
Cc: Michal Hocko <mho...@suse.cz>
Cc: Yinghai Lu <ying...@kernel.org>
Cc: Wen Congyang <we...@cn.fujitsu.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: Tejun Heo <t...@kernel.org>
Cc: sparcli...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux...@kvack.org
---
 arch/sparc/mm/init_64.c |   12 ------------
 arch/x86/mm/init_64.c   |   12 ------------
 mm/bootmem.c            |    6 ++++++
 mm/nobootmem.c          |    6 ++++++
 4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index b1e35b7..5530c09 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2027,16 +2027,6 @@ static void __init patch_tlb_miss_handler_bitmap(void)
        flushi(&valid_addr_bitmap_insn[0]);
 }
 
-static void __init register_page_bootmem_info(void)
-{
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-       int i;
-
-       for_each_online_node(i)
-               if (NODE_DATA(i)->node_spanned_pages)
-                       register_page_bootmem_info_node(NODE_DATA(i));
-#endif
-}
 void __init mem_init(void)
 {
        unsigned long addr, last;
@@ -2052,8 +2042,6 @@ void __init mem_init(void)
        patch_tlb_miss_handler_bitmap();
 
        high_memory = __va(last_valid_pfn << PAGE_SHIFT);
-
-       register_page_bootmem_info();
        free_all_bootmem();
 
        /*
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 650264b..72b5141 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1031,24 +1031,12 @@ int __ref arch_remove_memory(u64 start, u64 size)
 
 static struct kcore_list kcore_vsyscall;
 
-static void __init register_page_bootmem_info(void)
-{
-#ifdef CONFIG_NUMA
-       int i;
-
-       for_each_online_node(i)
-               register_page_bootmem_info_node(NODE_DATA(i));
-#endif
-}
-
 void __init mem_init(void)
 {
        pci_iommu_alloc();
 
        /* clear_bss() already clear the empty_zero_page */
 
-       register_page_bootmem_info();
-
        /* this will put all memory onto the freelists */
        free_all_bootmem();
        after_bootmem = 1;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index fab8f63..3cf36ac 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -273,6 +273,12 @@ unsigned long __init free_all_bootmem(void)
 {
        unsigned long total_pages = 0;
        bootmem_data_t *bdata;
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+       pg_data_t *pgdat;
+
+       for_each_online_pgdat(pgdat)
+               register_page_bootmem_info_node(pgdat);
+#endif
 
        reset_all_zones_managed_pages();
 
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 6b63cd6..ccc6630 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -166,6 +166,12 @@ void __init reset_all_zones_managed_pages(void)
 unsigned long __init free_all_bootmem(void)
 {
        unsigned long pages;
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+       pg_data_t *pgdat;
+
+       for_each_online_pgdat(pgdat)
+               register_page_bootmem_info_node(pgdat);
+#endif
 
        reset_all_zones_managed_pages();
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to