Cleanup ARM arches to use common memblocks_present
Subsystems (2)
cover Cleanup ARM arches to use common memblocks_present
Hey,
We've recently added a new memblocks_present() helper macro to clean up some common code with ARM and code we are adding in RISC-V. The commit that added the helper is:
9def36e0fa9a ("mm/sparse: add common helper to mark all memblocks present")
This series includes two patches to switch ARM and ARM64 to use the new function.
Thanks,
Logan
--
Logan Gunthorpe (2):
ARM: mm: make use of new memblocks_present() helper
arm64: mm: make use of new memblocks_present() helper
arch/arm/mm/init.c | 17 +---------------- arch/arm64/mm/init.c | 20 +------------------- 2 files changed, 2 insertions(+), 35 deletions(-)
--
2.19.0
PATCH 1/2 ARM: mm: make use of new memblocks_present() helper
Cleanup the arm_memory_present() function seeing it's very similar to other arches.
The new memblocks_present() helper checks for node ids which the arm version did not. However, this is equivalent seeing HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore memblock_get_region_node() should return 0.
--- arch/arm/mm/init.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
arch/arm/mm/init.c +1 -16
@@ -182,21 +182,6 @@ int pfn_valid(unsigned long pfn)EXPORT_SYMBOL (pfn_valid);#endif -#ifndef CONFIG_SPARSEMEM -static void __init arm_memory_present (void ) -{ -} -#else -static void __init arm_memory_present (void ) -{ -struct memblock_region *reg; - -for_each_memblock (memory, reg) -memory_present (0 ,memblock_region_memory_base_pfn (reg), -memblock_region_memory_end_pfn (reg)); -} -#endif -static bool arm_memblock_steal_permitted = true;phys_addr_t __init arm_memblock_steal (phys_addr_t size,phys_addr_t align)
@@ -292,7 +277,7 @@ void __init bootmem_init(void)* Sparsemem tries to allocate bootmem in memory_present(), * so must be done after the fixed reservations */ -arm_memory_present (); +memblocks_present ();/* * sparse_init() needs the bootmem allocator up and running.
Signature · 1 line
2.19.0
PATCH 2/2 arm64: mm: make use of new memblocks_present() helper
In reply to Logan GunthorpeCleanup the arm64_memory_present() function seeing it's very similar to other arches.
memblocks_present() is a direct replacement of arm64_memory_present()
--- arch/arm64/mm/init.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
arch/arm64/mm/init.c +1 -19
@@ -285,24 +285,6 @@ int pfn_valid(unsigned long pfn) }EXPORT_SYMBOL (pfn_valid); -#ifndef CONFIG_SPARSEMEM -static void __init arm64_memory_present (void ) -{ -} -#else -static void __init arm64_memory_present (void ) -{ -struct memblock_region *reg; - -for_each_memblock (memory, reg) { -int nid =memblock_get_region_node (reg); - -memory_present (nid,memblock_region_memory_base_pfn (reg), -memblock_region_memory_end_pfn (reg)); - } -} -#endif -static phys_addr_t memory_limit =PHYS_ADDR_MAX ;/*
@@ -489,7 +471,7 @@ void __init bootmem_init(void)* Sparsemem tries to allocate bootmem in memory_present(), so must be * done after the fixed reservations. */ -arm64_memory_present (); +memblocks_present ();sparse_init ();zone_sizes_init (min, max);
Signature · 1 line
2.19.0
Re: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
Quoted 11 lines · Logan Gunthorpe
Cleanup the
arm64_memory_present()function seeing it's very similar to other arches.
memblocks_present()is a direct replacement ofarm64_memory_present()Signed-off-by Logan Gunthorpe <[email protected]>Acked-by Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>--- arch/arm64/mm/init.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
Did you want us to take this via the arm64 tree?
Will
Re: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
Quoted 13 lines · Will Deacon
Quoted 11 lines · Logan Gunthorpe
Cleanup the
arm64_memory_present()function seeing it's very similar to other arches.
memblocks_present()is a direct replacement ofarm64_memory_present()Signed-off-by Logan Gunthorpe <[email protected]>Acked-by Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>--- arch/arm64/mm/init.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
Quoted 3 lines
Acked-by Will Deacon <[email protected]>Did you want us to take this via the arm64 tree?
Yes please.
Thanks,
Logan
Catalin Marinas
maintainerRe: [PATCH 2/2] arm64: mm: make use of new memblocks_present() helper
Quoted 14 lines · Logan Gunthorpe
Quoted 13 lines · Will Deacon
Quoted 11 lines · Logan Gunthorpe
Cleanup the
arm64_memory_present()function seeing it's very similar to other arches.
memblocks_present()is a direct replacement ofarm64_memory_present()Signed-off-by Logan Gunthorpe <[email protected]>Acked-by Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>--- arch/arm64/mm/init.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
Quoted 5 lines
Quoted 3 lines
Acked-by Will Deacon <[email protected]>Did you want us to take this via the arm64 tree?
Yes please.
Patch 2/2 queued for 5.1. Thanks.
Signature · 1 line
Catalin