Fix NUMA without SMP
Subsystems (5)
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 TorvaldsPATCH 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.
--- kernel/sched/topology.c | 1 - mm/page_alloc.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
kernel/sched/topology.c +0 -1
@@ -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
@@ -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
Re: [PATCH 1/2] mm: Move node_reclaim_distance to fix NUMA without SMP
Quoted 11 lines · Geert Uytterhoeven
If
CONFIG_NUMA=y, butCONFIG_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_distancefrom an SMP-only to a generic file.Fixes a55c7454a8c887b2 ("sched/topology: Improve load balancing on AMD EPYC systems")Suggested-by Matt Fleming <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>
Signature · 2 lines
Mel Gorman SUSE Labs
PATCH 2/2 mm: Move fold_vm_numa_events() to fix NUMA without SMP
In reply to Geert UytterhoevenIf 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.
--- mm/vmstat.c | 56 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-)
mm/vmstat.c +28 -28
@@ -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
Re: [PATCH 2/2] mm: Move fold_vm_numa_events() to fix NUMA without SMP
Quoted 9 lines · Geert Uytterhoeven
If
CONFIG_NUMA=y, butCONFIG_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")Signed-off-by Geert Uytterhoeven <[email protected]>
Signature · 2 lines
Mel Gorman SUSE Labs