linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix NUMA without SMP
@ 2021-09-16  8:42 Geert Uytterhoeven
  2021-09-16  8:42 ` [PATCH 1/2] mm: Move node_reclaim_distance to fix " Geert Uytterhoeven
  2021-09-16  8:42 ` [PATCH 2/2] mm: Move fold_vm_numa_events() " Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2021-09-16  8:42 UTC (permalink / raw)
  To: Matt Fleming, Mel Gorman, Peter Zijlstra, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Andrew Morton, Vlastimil Babka
  Cc: Yoshinori Sato, Rich Felker, Gon Solo, linux-mm, linux-sh,
	linux-kernel, Geert Uytterhoeven

	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(-)

-- 
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mm: Move node_reclaim_distance to fix NUMA without SMP
  2021-09-16  8:42 [PATCH 0/2] Fix NUMA without SMP Geert Uytterhoeven
@ 2021-09-16  8:42 ` Geert Uytterhoeven
  2021-09-21 12:32   ` Mel Gorman
  2021-09-16  8:42 ` [PATCH 2/2] mm: Move fold_vm_numa_events() " Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2021-09-16  8:42 UTC (permalink / raw)
  To: Matt Fleming, Mel Gorman, Peter Zijlstra, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Andrew Morton, Vlastimil Babka
  Cc: Yoshinori Sato, Rich Felker, Gon Solo, linux-mm, linux-sh,
	linux-kernel, 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")
Suggested-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mm: Move fold_vm_numa_events() to fix NUMA without SMP
  2021-09-16  8:42 [PATCH 0/2] Fix NUMA without SMP Geert Uytterhoeven
  2021-09-16  8:42 ` [PATCH 1/2] mm: Move node_reclaim_distance to fix " Geert Uytterhoeven
@ 2021-09-16  8:42 ` Geert Uytterhoeven
  2021-09-21 12:33   ` Mel Gorman
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2021-09-16  8:42 UTC (permalink / raw)
  To: Matt Fleming, Mel Gorman, Peter Zijlstra, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Andrew Morton, Vlastimil Babka
  Cc: Yoshinori Sato, Rich Felker, Gon Solo, linux-mm, linux-sh,
	linux-kernel, 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")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 mm/vmstat.c | 56 ++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 8ce2620344b2f8b4..5db54581feab9ac9 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -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.
  *
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] mm: Move node_reclaim_distance to fix NUMA without SMP
  2021-09-16  8:42 ` [PATCH 1/2] mm: Move node_reclaim_distance to fix " Geert Uytterhoeven
@ 2021-09-21 12:32   ` Mel Gorman
  0 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2021-09-21 12:32 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Matt Fleming, Peter Zijlstra, Ingo Molnar, Juri Lelli,
	Vincent Guittot, Andrew Morton, Vlastimil Babka, Yoshinori Sato,
	Rich Felker, Gon Solo, linux-mm, linux-sh, linux-kernel

On Thu, Sep 16, 2021 at 10:42:42AM +0200, Geert Uytterhoeven wrote:
> 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@codeblueprint.co.uk>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mm: Move fold_vm_numa_events() to fix NUMA without SMP
  2021-09-16  8:42 ` [PATCH 2/2] mm: Move fold_vm_numa_events() " Geert Uytterhoeven
@ 2021-09-21 12:33   ` Mel Gorman
  0 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2021-09-21 12:33 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Matt Fleming, Peter Zijlstra, Ingo Molnar, Juri Lelli,
	Vincent Guittot, Andrew Morton, Vlastimil Babka, Yoshinori Sato,
	Rich Felker, Gon Solo, linux-mm, linux-sh, linux-kernel

On Thu, Sep 16, 2021 at 10:42:43AM +0200, Geert Uytterhoeven wrote:
> 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")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-21 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16  8:42 [PATCH 0/2] Fix NUMA without SMP Geert Uytterhoeven
2021-09-16  8:42 ` [PATCH 1/2] mm: Move node_reclaim_distance to fix " Geert Uytterhoeven
2021-09-21 12:32   ` Mel Gorman
2021-09-16  8:42 ` [PATCH 2/2] mm: Move fold_vm_numa_events() " Geert Uytterhoeven
2021-09-21 12:33   ` Mel Gorman

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).