Skip to contentSkip to conversation

Fix NUMA without SMP

PATCH Applied Geert Uytterhoeven 2 participants 5 messages Sep 16, 2021 – Sep 21, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Fix NUMA without SMP

Hi all,

SuperH is the only architecture which still supports NUMA without SMP, for good reasons (various memories scattered around the address space, each with varying latencies). This series fixes two build errors due to variables and functions used by the NUMA code being provided by SMP-only source files or sections.

These are compile-tested only, as the remote Migo-R is MIA.

Thanks for your comments!

Geert Uytterhoeven (2):
mm: Move node_reclaim_distance to fix NUMA without SMP
mm: Move fold_vm_numa_events() to fix NUMA without SMP

 kernel/sched/topology.c |  1 -
 mm/page_alloc.c         |  2 ++
 mm/vmstat.c             | 56 ++++++++++++++++++++---------------------
 3 files changed, 30 insertions(+), 29 deletions(-)
Signature · 12 lines
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

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

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")
---
 kernel/sched/topology.c | 1 -
 mm/page_alloc.c         | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
kernel/sched/topology.c +0 -1
index 4e8698e62f0754a3..738ee7fa79724c7d 100644
@@ -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
mm/page_alloc.c +2 -0
index b37435c274cf1cb1..8b2d7a9bae6c1754 100644
@@ -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)) <=
Signature · 1 line
2.25.1
reviewer Acked-by on v1 1/2
#2 lore raw

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

Quoted 11 lines · Geert Uytterhoeven

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")
Signature · 2 lines
Mel Gorman
SUSE Labs
#3 lore raw

PATCH 2/2 mm: Move fold_vm_numa_events() to fix NUMA without SMP

In reply to Geert Uytterhoeven

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

sh4-linux-gnu-ld: mm/vmstat.o: in function `vmstat_start':
vmstat.c:(.text+0x97c): undefined reference to `fold_vm_numa_events'
sh4-linux-gnu-ld: drivers/base/node.o: in function `node_read_vmstat':
node.c:(.text+0x140): undefined reference to `fold_vm_numa_events'
sh4-linux-gnu-ld: drivers/base/node.o: in function `node_read_numastat':
node.c:(.text+0x1d0): undefined reference to `fold_vm_numa_events'

Fix this by moving fold_vm_numa_events() outside the SMP-only section.

Fixes f19298b9516c1a03 ("mm/vmstat: convert NUMA statistics to basic NUMA counters")
---
 mm/vmstat.c | 56 ++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)
mm/vmstat.c +28 -28
index 8ce2620344b2f8b4..5db54581feab9ac9 100644
@@ -165,6 +165,34 @@ atomic_long_t vm_numa_event[NR_VM_NUMA_EVENT_ITEMS] __cacheline_aligned_in_smp;
 EXPORT_SYMBOL(vm_zone_stat);
 EXPORT_SYMBOL(vm_node_stat);
 
+#ifdef CONFIG_NUMA
+static void fold_vm_zone_numa_events(struct zone *zone)
+{
+	unsigned long zone_numa_events[NR_VM_NUMA_EVENT_ITEMS] = { 0, };
+	int cpu;
+	enum numa_stat_item item;
+
+	for_each_online_cpu(cpu) {
+		struct per_cpu_zonestat *pzstats;
+
+		pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu);
+		for (item = 0; item < NR_VM_NUMA_EVENT_ITEMS; item++)
+			zone_numa_events[item] += xchg(&pzstats->vm_numa_event[item], 0);
+	}
+
+	for (item = 0; item < NR_VM_NUMA_EVENT_ITEMS; item++)
+		zone_numa_event_add(zone_numa_events[item], zone, item);
+}
+
+void fold_vm_numa_events(void)
+{
+	struct zone *zone;
+
+	for_each_populated_zone(zone)
+		fold_vm_zone_numa_events(zone);
+}
+#endif
+
 #ifdef CONFIG_SMP
 
 int calculate_pressure_threshold(struct zone *zone)
@@ -771,34 +799,6 @@ static int fold_diff(int *zone_diff, int *node_diff)
 	return changes;
 }
 
-#ifdef CONFIG_NUMA
-static void fold_vm_zone_numa_events(struct zone *zone)
-{
-	unsigned long zone_numa_events[NR_VM_NUMA_EVENT_ITEMS] = { 0, };
-	int cpu;
-	enum numa_stat_item item;
-
-	for_each_online_cpu(cpu) {
-		struct per_cpu_zonestat *pzstats;
-
-		pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu);
-		for (item = 0; item < NR_VM_NUMA_EVENT_ITEMS; item++)
-			zone_numa_events[item] += xchg(&pzstats->vm_numa_event[item], 0);
-	}
-
-	for (item = 0; item < NR_VM_NUMA_EVENT_ITEMS; item++)
-		zone_numa_event_add(zone_numa_events[item], zone, item);
-}
-
-void fold_vm_numa_events(void)
-{
-	struct zone *zone;
-
-	for_each_populated_zone(zone)
-		fold_vm_zone_numa_events(zone);
-}
-#endif
-
 /*
  * Update the zone counters for the current cpu.
  *
Signature · 1 line
2.25.1
reviewer Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] mm: Move fold_vm_numa_events() to fix NUMA without SMP

Quoted 9 lines · Geert Uytterhoeven

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

sh4-linux-gnu-ld: mm/vmstat.o: in function `vmstat_start':
vmstat.c:(.text+0x97c): undefined reference to `fold_vm_numa_events'
sh4-linux-gnu-ld: drivers/base/node.o: in function `node_read_vmstat':
node.c:(.text+0x140): undefined reference to `fold_vm_numa_events'
sh4-linux-gnu-ld: drivers/base/node.o: in function `node_read_numastat':
node.c:(.text+0x1d0): undefined reference to `fold_vm_numa_events'

Quoted 4 lines

Fix this by moving fold_vm_numa_events() outside the SMP-only section.

Fixes f19298b9516c1a03 ("mm/vmstat: convert NUMA statistics to basic NUMA counters")
Signature · 2 lines
Mel Gorman
SUSE Labs