[PATCH 19/25] mm/fbatch: vm/stat_refresh include lru_add_drain() on each cpu
From: Hugh Dickins
Date: Mon Aug 24 2026 - 10:47:59 EST
Reading or writing /proc/sys/vm/stat_refresh has long been a way for
testing to force an immediate refresh of /proc/vmstat numbers: it seems
appropriate that it should also call lru_add_drain() on each cpu that it
visits, before collecting that processor's diffs.
Add that in refresh_vm_stats(). I wanted it in refresh_cpu_vm_stats(),
which would include it in the regular (default HZ) vmstat_update() too:
which might be a wise precaution when proposing to eliminate almost all
the old calls to lru_add_drain_all(). However, that would go against its
"strives to only access node local memory" cacheline care, and bring it
into lruvec lock contention: which would probably displease its authors.
Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
mm/vmstat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 3b5cb1031f72..0f75488687b5 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1973,6 +1973,7 @@ static int vmstat_late_init_done;
#ifdef CONFIG_PROC_FS
static void refresh_vm_stats(struct work_struct *work)
{
+ lru_add_drain();
refresh_cpu_vm_stats(true);
}
--
2.51.0