Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] mm: pcp->high is never decayed on isolated CPUs
@ 2026-11-26 13:44 Ionut Nechita (Wind River)
  2026-11-26 13:44 ` [RFC PATCH 1/1] mm/vmstat: decay pcp->high of isolated CPUs from vmstat_shepherd Ionut Nechita (Wind River)
  0 siblings, 1 reply; 3+ messages in thread
From: Ionut Nechita (Wind River) @ 2026-11-26 13:44 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Vlastimil Babka, Michal Hocko, Johannes Weiner,
	Suren Baghdasaryan, Brendan Jackman, Zi Yan, David Hildenbrand,
	Liam R . Howlett, Mike Rapoport, Huang Ying, Marcelo Tosatti,
	Frederic Weisbecker, Sebastian Andrzej Siewior, Clark Williams,
	Steven Rostedt, linux-rt-devel, linux-kernel, ionut_n2001,
	sunlightlinux, Ionut Nechita

From: Ionut Nechita <ionut.nechita@windriver.com>

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-27 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 13:44 [RFC PATCH 0/1] mm: pcp->high is never decayed on isolated CPUs Ionut Nechita (Wind River)
2026-11-26 13:44 ` [RFC PATCH 1/1] mm/vmstat: decay pcp->high of isolated CPUs from vmstat_shepherd Ionut Nechita (Wind River)
2026-11-27 13:46   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox