[PATCH] mm/vmstat: stagger per-cpu vmstat updates to avoid zone->lock contention

From: Dmitry Ilvokhin

Date: Thu Apr 02 2026 - 07:49:06 EST


Fix by spreading the shepherd's initial wakeup across the stat plain
sysctl_stat_interval to preserve the stagger. Every CPU still fires once
per interval, same frequency, different phase.

Signed-off-by: Dmitry Ilvokhin <d@xxxxxxxxxxxx>
---
mm/vmstat.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 2370c6fb1fcd..aee99786718a 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -2042,7 +2042,7 @@ static void vmstat_update(struct work_struct *w)
*/
queue_delayed_work_on(smp_processor_id(), mm_percpu_wq,
this_cpu_ptr(&vmstat_work),
- round_jiffies_relative(sysctl_stat_interval));
+ sysctl_stat_interval);
}
}

@@ -2140,7 +2140,8 @@ static void vmstat_shepherd(struct work_struct *w)
continue;

if (!delayed_work_pending(dw) && need_update(cpu))
- queue_delayed_work_on(cpu, mm_percpu_wq, dw, 0);
+ queue_delayed_work_on(cpu, mm_percpu_wq, dw,
+ (sysctl_stat_interval * cpu) / nr_cpu_ids);
}

cond_resched();
--
2.52.0