arm64: mm: simplify memblock numa node extraction
Mark Rutland
reviewerPATCH 1/1 arm64: mm: simplify memblock numa node extraction
We currently open-code extracting the NUMA node of a memblock region, which requires an ifdef to cater for !CONFIG_NUMA builds where the memblock_region::nid field does not exist.
The generic memblock_get_region_node helper is intended to cater for this. For CONFIG_HAVE_MEMBLOCK_NODE_MAP, builds this returns reg->nid, and for for !CONFIG_HAVE_MEMBLOCK_NODE_MAP builds this is a static inline that returns 0. Note that for arm64, CONFIG_HAVE_MEMBLOCK_NODE_MAP is selected iff CONFIG_NUMA is.
This patch makes use of memblock_get_region_node to simplify the arm64 code. At the same time, we can move the nid variable definition into the loop, as this is the only place it is used.
--- arch/arm64/mm/init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/mm/init.c +2 -4
@@ -160,12 +160,10 @@ static void __init arm64_memory_present(void)static void __init arm64_memory_present (void ) {struct memblock_region *reg; -int nid =0 ;for_each_memblock (memory, reg) { -#ifdef CONFIG_NUMA - nid = reg->nid; -#endif +int nid =memblock_get_region_node (reg); +memory_present (nid,memblock_region_memory_base_pfn (reg),memblock_region_memory_end_pfn (reg)); }
Signature · 1 line
1.9.1
PATCH 1/1 arm64: mm: simplify memblock numa node extraction
Quoted 14 lines · Mark Rutland
We currently open-code extracting the NUMA node of a memblock region, which requires an ifdef to cater for !CONFIG_NUMA builds where the
memblock_region::nidfield does not exist.The generic
memblock_get_region_nodehelper is intended to cater for this. ForCONFIG_HAVE_MEMBLOCK_NODE_MAP, builds this returnsreg->nid, and for for !CONFIG_HAVE_MEMBLOCK_NODE_MAP builds this is a static inline that returns 0. Note that for arm64,CONFIG_HAVE_MEMBLOCK_NODE_MAPis selected iffCONFIG_NUMAis.This patch makes use of
memblock_get_region_nodeto simplify the arm64 code. At the same time, we can move the nid variable definition into the loop, as this is the only place it is used.
Quoted 7 lines
Signed-off-by Mark Rutland <[email protected]>Reviewed-by Steve Capper <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>--- arch/arm64/mm/init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Looks like a straightforward cleanup to me:
Will
PATCH 1/1 arm64: mm: simplify memblock numa node extraction
In reply to Mark RutlandQuoted 10 lines · Mark Rutland
We currently open-code extracting the NUMA node of a memblock region, which requires an ifdef to cater for !CONFIG_NUMA builds where the
memblock_region::nidfield does not exist.The generic
memblock_get_region_nodehelper is intended to cater for this. ForCONFIG_HAVE_MEMBLOCK_NODE_MAP, builds this returnsreg->nid, and for for !CONFIG_HAVE_MEMBLOCK_NODE_MAP builds this is a static inline that returns 0. Note that for arm64,CONFIG_HAVE_MEMBLOCK_NODE_MAPis selected iffCONFIG_NUMAis.
Quoted 8 lines
This patch makes use of
memblock_get_region_nodeto simplify the arm64 code. At the same time, we can move the nid variable definition into the loop, as this is the only place it is used.Signed-off-by Mark Rutland <[email protected]>Reviewed-by Steve Capper <[email protected]>Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>
Applied. Thanks.
Signature · 1 line
Catalin