powerpc: Use HAVE_MEMBLOCK_NODE_MAP
RFC PATCH 1/1 powerpc: Use HAVE_MEMBLOCK_NODE_MAP
powerpc doesn't access early_node_map[] directly and enabling HAVE_MEMBLOCK_NODE_MAP is trivial - replacing add_active_range() calls with memblock_set_node() and selecting HAVE_MEMBLOCK_NODE_MAP is enough.
---
benh, the proposed memblock changes are now in tip:x86/memblock, which is probably scheduled for the next merge window. This patch converts powerpc to drop early_node_map[] and put NUMA information in memblock. I'm planning on converting all early_node_map[] users and dropping the code. I don't have access to ppc NUMA machine so the patch is tested only on a non-NUMA SMP machine. It builds fine for all valid combinations of of 32/64 [!]SMP [!]NUMA.
If this change is okay, how should this patch be routed? ppc tree pulls from x86/memblock and puts this patch on top of it?
Thanks.
arch/powerpc/Kconfig | 1 + arch/powerpc/mm/mem.c | 2 +- arch/powerpc/mm/numa.c | 10 ++++------ 3 files changed, 6 insertions(+), 7 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -117,6 +117,7 @@ config PPC select HAVE_KRETPROBES select HAVE_ARCH_TRACEHOOK select HAVE_MEMBLOCK + select HAVE_MEMBLOCK_NODE_MAP select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG select USE_GENERIC_SMP_HELPERS if SMP
arch/powerpc/mm/mem.c +1 -1
@@ -197,7 +197,7 @@ void __init do_init_bootmem(void)unsigned long start_pfn, end_pfn; start_pfn =memblock_region_memory_base_pfn (reg); end_pfn =memblock_region_memory_end_pfn (reg); -add_active_range (0 , start_pfn, end_pfn); +memblock_set_node (0 , (phys_addr_t )ULLONG_MAX ,0 ); }/* Add all physical memory to the bootmem map, mark each area
arch/powerpc/mm/numa.c +4 -6
@@ -680,9 +680,7 @@ static void __init parse_drconf_memory(snode_set_online (nid); sz =numa_enforce_memory_limit (base, size);if (sz) -add_active_range (nid, base >>PAGE_SHIFT , - (base >>PAGE_SHIFT ) - + (sz >>PAGE_SHIFT )); +memblock_set_node (base, sz, nid); }while (--ranges); } }
@@ -772,8 +770,7 @@ new_range:continue ; } -add_active_range (nid, start >>PAGE_SHIFT , - (start >>PAGE_SHIFT ) + (size >>PAGE_SHIFT )); +memblock_set_node (start, size, nid);if (--ranges) goto new_range;
@@ -808,7 +805,8 @@ static void __init setup_nonnuma(void) end_pfn =memblock_region_memory_end_pfn (reg);fake_numa_create_new_node (end_pfn, &nid); -add_active_range (nid, start_pfn, end_pfn); +memblock_set_node (PFN_PHYS (start_pfn), +PFN_PHYS (end_pfn - start_pfn), nid);node_set_online (nid); } }