Skip to contentSkip to conversation

vmstat: call fold_vm_zone_numa_events() before show per zone NUMA event

PATCH Applied [email protected] 2 participants 2 messages Nov 1, 2024

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

PATCH v2 1/1 vmstat: call fold_vm_zone_numa_events() before show per zone NUMA event

From: MengEn Sun <[email protected]>

Since 5.14-rc1, NUMA events will only be folded from per-CPU statistics to per zone and global statistics when the user actually needs it.

Currently, the kernel has performs the fold operation when reading /proc/vmstat, but does not perform the fold operation in /proc/zoneinfo. This can lead to inaccuracies in the following statistics in zoneinfo:
- numa_hit
- numa_miss
- numa_foreign
- numa_interleave
- numa_local
- numa_other

Therefore, before printing per-zone vm_numa_event when reading /proc/zoneinfo, we should also perform the fold operation.

Fixes f19298b9516c ("mm/vmstat: convert NUMA statistics to basic NUMA counters")

---
changelog:
v1: https://lore.kernel.org/linux-mm/[email protected]/
v2: made some modifications to the commit message:
- Made the commit information more detailed
- Added the range of versions that need to be fixed.

---
 mm/vmstat.c | 1 +
 1 file changed, 1 insertion(+)
mm/vmstat.c +1 -0
index b5a4cea..2770800 100644
@@ -1778,6 +1778,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
 			   zone_page_state(zone, i));
 
 #ifdef CONFIG_NUMA
+	fold_vm_zone_numa_events(zone);
 	for (i = 0; i < NR_VM_NUMA_EVENT_ITEMS; i++)
 		seq_printf(m, "\n      %-12s %lu", numa_stat_name(i),
 			   zone_numa_event_state(zone, i));
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 4 lines · On Fri, 1 Nov 2024 12:06:38 +0800 [email protected] wrote:

Since 5.14-rc1, NUMA events will only be folded from per-CPU statistics to per zone and global statistics when the user actually needs it.

Quoted 10 lines

Currently, the kernel has performs the fold operation when reading /proc/vmstat, but does not perform the fold operation in /proc/zoneinfo. This can lead to inaccuracies in the following statistics in zoneinfo:
- numa_hit
- numa_miss
- numa_foreign
- numa_interleave
- numa_local
- numa_other

Maybe we should backport this. Please tell us more about these inaccuracies. How large are they and what is the impact upon our users?