From: Andrew Morton <akpm@linux-foundation.org>
To: Chris Wiseman <chriswiseman@google.com>
Cc: Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@gentwo.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH] percpu: skip sidelined slot in pcpu_balance_populated()
Date: Tue, 24 Nov 2026 18:04:23 -0800 [thread overview]
Message-ID: <20261124180423.ca36e90d4cabaab8b2dc4721@linux-foundation.org> (raw)
In-Reply-To: <18e88cd2a725491b.3137322e32332e3235332e313736.c1dd7.0000sendgmr@google.com>
On Mon, 16 Nov 2026 14:28:07 +0000 Chris Wiseman <chriswiseman@google.com> wrote:
> Commit f183324133ea ("percpu: implement partial chunk depopulation")
> placed pcpu_sidelined_slot at __pcpu_size_to_slot(pcpu_unit_size) + 1
> and moved pcpu_free_slot to pcpu_sidelined_slot + 1 so pcpu_alloc()
> checks sidelined chunks before free chunks. pcpu_balance_populated()
> also loops from pcpu_size_to_slot(PAGE_SIZE) through pcpu_free_slot,
> but was not updated to skip pcpu_sidelined_slot.
>
> When pcpu_nr_empty_pop_pages drops below PCPU_EMPTY_POP_PAGES_HIGH and
> active chunks have no unpopulated pages, pcpu_balance_populated() walks
> into pcpu_sidelined_slot and repopulates chunks that were just sidelined
> to save memory. Because chunk->isolated is still true on sidelined
> chunks, pcpu_update_empty_pages() does not count those newly populated
> pages toward pcpu_nr_empty_pop_pages. That leaves the global empty page
> count below the threshold, so subsequent balance passes keep refilling
> every sidelined chunk back to 100% before reaching pcpu_free_slot.
>
> Skip pcpu_sidelined_slot in pcpu_balance_populated() so sidelined chunks
> stay depopulated until pcpu_alloc() actually needs them.
Seems right, thanks.
> Benchmark results (4-CPU arm64, 4 sidelined chunks with 60 reclaimed
> pages after triggering pcpu_balance_populated()):
>
> Metric Before After Delta
> --------------------------------------------------------------------
> Sidelined pages repopulated 60 0 -100%
> Sidelined backing pages (kB) 960 0 -960 kB
>
> Fixes: f183324133ea ("percpu: implement partial chunk depopulation")
Added in 2021.
> Cc: stable@vger.kernel.org
Why the cc:stable? The changelog doesn't clearly describe the
userspace-visible runtime effects of this flaw (please always include
this!) so I'm struggling to understand this decision?
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -2045,6 +2045,9 @@ static void pcpu_balance_populated(void)
> if (!nr_to_pop)
> break;
>
> + if (slot == pcpu_sidelined_slot)
> + continue;
> +
> list_for_each_entry(chunk, &pcpu_chunk_lists[slot], list) {
> nr_unpop = chunk->nr_pages - chunk->nr_populated;
> if (nr_unpop)
> --
> 2.47.0
prev parent reply other threads:[~2026-11-25 2:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 14:28 Chris Wiseman
2026-11-25 2:04 ` Andrew Morton [this message]
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=20261124180423.ca36e90d4cabaab8b2dc4721@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=chriswiseman@google.com \
--cc=cl@gentwo.org \
--cc=dennis@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=roman.gushchin@linux.dev \
--cc=tj@kernel.org \
/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®