* [PATCH] arm64: mm: simplify memblock numa node extraction
@ 2016-06-22 11:13 Mark Rutland
2016-06-27 16:24 ` Will Deacon
2016-06-27 17:06 ` Catalin Marinas
0 siblings, 2 replies; 3+ messages in thread
From: Mark Rutland @ 2016-06-22 11:13 UTC (permalink / raw)
To: linux-arm-kernel
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: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/mm/init.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index d45f862..0652d60 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -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));
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] arm64: mm: simplify memblock numa node extraction
2016-06-22 11:13 [PATCH] arm64: mm: simplify memblock numa node extraction Mark Rutland
@ 2016-06-27 16:24 ` Will Deacon
2016-06-27 17:06 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2016-06-27 16:24 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 22, 2016 at 12:13:45PM +0100, Mark Rutland wrote:
> 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: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Steve Capper <steve.capper@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
> arch/arm64/mm/init.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Looks like a straightforward cleanup to me:
Acked-by: Will Deacon <will.deacon@arm.com>
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arm64: mm: simplify memblock numa node extraction
2016-06-22 11:13 [PATCH] arm64: mm: simplify memblock numa node extraction Mark Rutland
2016-06-27 16:24 ` Will Deacon
@ 2016-06-27 17:06 ` Catalin Marinas
1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2016-06-27 17:06 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 22, 2016 at 12:13:45PM +0100, Mark Rutland wrote:
> 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: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Steve Capper <steve.capper@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
Applied. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-27 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 11:13 [PATCH] arm64: mm: simplify memblock numa node extraction Mark Rutland
2016-06-27 16:24 ` Will Deacon
2016-06-27 17:06 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).