Commit ea2cbee3 authored by Mark Rutland's avatar Mark Rutland Committed by Catalin Marinas

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.
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Reviewed-by: default avatarSteve Capper <steve.capper@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 221f2c77
...@@ -160,12 +160,10 @@ static void __init arm64_memory_present(void) ...@@ -160,12 +160,10 @@ static void __init arm64_memory_present(void)
static void __init arm64_memory_present(void) static void __init arm64_memory_present(void)
{ {
struct memblock_region *reg; struct memblock_region *reg;
int nid = 0;
for_each_memblock(memory, reg) { for_each_memblock(memory, reg) {
#ifdef CONFIG_NUMA int nid = memblock_get_region_node(reg);
nid = reg->nid;
#endif
memory_present(nid, memblock_region_memory_base_pfn(reg), memory_present(nid, memblock_region_memory_base_pfn(reg),
memblock_region_memory_end_pfn(reg)); memblock_region_memory_end_pfn(reg));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment