[RFC PATCH 0/1] mm: pcp->high is never decayed on isolated CPUs
From: Ionut Nechita (Wind River)
Date: Thu Nov 26 2026 - 08:46:03 EST
From: Ionut Nechita <ionut.nechita@xxxxxxxxxxxxx>
Hi,
On isolated (nohz_full) CPUs, pcp->high can be raised by PCP
auto-tuning but is never lowered again, and the pages cached on those
pcp lists are never given back. They are neither counted as free
memory nor attributed in /proc/allocinfo, so on a long-running system
they show up as a growing amount of "unaccounted" kernel memory.
This comes from the combination of two changes:
- be5e015d107d ("vmstat: skip periodic vmstat update for isolated
CPUs"): vmstat_shepherd() no longer queues vmstat_update() on
isolated CPUs, and quiet_vmstat() calls refresh_cpu_vm_stats(false),
which skips the pageset work.
- 51a755c56dc0 ("mm: tune PCP high automatically"): pcp->high can grow
up to about managed/8 of the zone, spread over the node's CPUs, and
the only thing that shrinks it is decay_pcp_high(), called from
refresh_cpu_vm_stats(true).
We hit this on a single-node, 64-CPU Sapphire Rapids system (256 GB)
running a PREEMPT_RT kernel with nohz_full=1-31,33-63 and a
containerized telco workload. After 8 days of uptime about 28 GiB were
sitting on the pcp lists, mostly on isolated CPUs, with pcp->count close
to pcp->high_max on most of them:
- Setting vm.percpu_pagelist_high_fraction to a non-zero value lowered
pcp->high, but idle isolated CPUs still held 300-450 MiB each, well
above the new high, because nothing on those CPUs trims the lists.
- Only a remote drain_all_pages() gave the memory back: MemFree went
from 126.5 to 154.5 GiB and MemAvailable from 157 to 185 GiB.
The patch lets vmstat_shepherd(), which runs on a housekeeping CPU, run
decay_pcp_high() remotely for isolated CPUs, under pcp->lock, the same
way drain_pages_zone() already accesses remote pagesets. The remote lock
is only taken when pcp->high is above high_min or pcp->count is above
pcp->high, so an isolated CPU whose pcp lists were never auto-tuned up
is not touched.
This is sent as RFC because I would like feedback on the approach:
1. Is remote decay from vmstat_shepherd() acceptable for isolated
CPUs? It is remote work on behalf of an isolated CPU, although
bounded and only after auto-tuning raised pcp->high. Alternatives I
considered:
- decaying from quiet_vmstat() on the isolated CPU itself, when it
stops the tick; on PREEMPT_RT zone->lock is a sleeping lock, so
freeing pages from that context is not possible there;
- not auto-tuning pcp->high on isolated CPUs at all, which would
penalize isolated workloads that allocate and free heavily.
2. decay_pcp_high() now also takes pcp->lock for the pcp->high update
on the local vmstat_update() path, which was lockless before.
3. The NUMA remote pageset expiry in refresh_cpu_vm_stats() has the
same problem on isolated CPUs. It is not addressed here.
Testing: so far only built with PREEMPT_RT and NO_HZ_FULL (W=1,
checkpatch clean). The analysis above was done on the affected system
with a 6.18-rt based kernel, but the patch itself has not been run on
hardware yet. I am sending it now to get early feedback on the approach
and will follow up with test results.
Thanks,
Ionut
Ionut Nechita (1):
mm/vmstat: decay pcp->high of isolated CPUs from vmstat_shepherd
mm/page_alloc.c | 43 +++++++++++++++++++++++++++++++++++++++++--
mm/page_alloc.h | 1 +
mm/vmstat.c | 14 ++++++++++----
3 files changed, 52 insertions(+), 6 deletions(-)
base-commit: 9437046953b2fb3bf55b36582450ea0267df82a7
--
2.55.0