mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Cc: Vlastimil Babka <vbabka@kernel.org>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Brendan Jackman <brendan.jackman@linux.dev>,
	Zi Yan <ziy@nvidia.com>, David Hildenbrand <david@kernel.org>,
	"Liam R . Howlett" <liam@infradead.org>,
	Mike Rapoport <rppt@kernel.org>,
	Huang Ying <ying.huang@linux.alibaba.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	ionut_n2001@yahoo.com, sunlightlinux@gmail.com,
	Ionut Nechita <ionut.nechita@windriver.com>
Subject: [RFC PATCH 0/1] mm: pcp->high is never decayed on isolated CPUs
Date: Thu, 26 Nov 2026 15:44:09 +0200	[thread overview]
Message-ID: <20261126134410.17447-1-ionut.nechita@windriver.com> (raw)

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


             reply	other threads:[~2026-11-26 13:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 13:44 Ionut Nechita (Wind River) [this message]
2026-11-26 13:44 ` [RFC PATCH 1/1] mm/vmstat: decay pcp->high of isolated CPUs from vmstat_shepherd Ionut Nechita (Wind River)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126134410.17447-1-ionut.nechita@windriver.com \
    --to=ionut.nechita@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=brendan.jackman@linux.dev \
    --cc=clrkwllms@kernel.org \
    --cc=david@kernel.org \
    --cc=frederic@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=ionut_n2001@yahoo.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=mhocko@suse.com \
    --cc=mtosatti@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=sunlightlinux@gmail.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®