[PATCH 1/2] mm: Move node_reclaim_distance to fix NUMA without SMP

From: Geert Uytterhoeven
Date: Thu Sep 16 2021 - 04:43:01 EST


If CONFIG_NUMA=y, but CONFIG_SMP=n (e.g. sh/migor_defconfig):

sh4-linux-gnu-ld: mm/page_alloc.o: in function `get_page_from_freelist':
page_alloc.c:(.text+0x2c24): undefined reference to `node_reclaim_distance'

Fix this by moving the declaration of node_reclaim_distance from an
SMP-only to a generic file.

Fixes: a55c7454a8c887b2 ("sched/topology: Improve load balancing on AMD EPYC systems")
Suggested-by: Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
---
kernel/sched/topology.c | 1 -
mm/page_alloc.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 4e8698e62f0754a3..738ee7fa79724c7d 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1481,7 +1481,6 @@ static int sched_domains_curr_level;
int sched_max_numa_distance;
static int *sched_domains_numa_distance;
static struct cpumask ***sched_domains_numa_masks;
-int __read_mostly node_reclaim_distance = RECLAIM_DISTANCE;

static unsigned long __read_mostly *sched_numa_onlined_nodes;
#endif
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b37435c274cf1cb1..8b2d7a9bae6c1754 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3966,6 +3966,8 @@ bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
}

#ifdef CONFIG_NUMA
+int __read_mostly node_reclaim_distance = RECLAIM_DISTANCE;
+
static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
{
return node_distance(zone_to_nid(local_zone), zone_to_nid(zone)) <=
--
2.25.1