From: Christian Loehle <christian.loehle@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Beata Michalska <beata.michalska@arm.com>,
Elif Topuz <elif.topuz@arm.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Shubhang Kaushik <sh@gentwo.org>,
Christoph Lameter <cl@gentwo.org>,
Huang Shijie <shijie@os.amperecomputing.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 2/2] sched/fair: Randomize equally shallow slow-path candidates
Date: Mon, 21 Sep 2026 16:39:52 +0100 [thread overview]
Message-ID: <2d93f0c3-a3c6-4789-bd38-1b289634b8a2@arm.com> (raw)
In-Reply-To: <CAKfTPtBft2pVrsZQGJu0UBjuqaGJ2ViE9N6YExLvBnpgEXDvag@mail.gmail.com>
On 9/17/26 17:06, Vincent Guittot wrote:
> On Thu, 17 Sept 2026 at 17:41, Christian Loehle
> <christian.loehle@arm.com> wrote:
>>
>> Picking the first eligible idle CPU leaves a scan-order bias. Concurrent
>> slow-path selectors can choose the same CPU before either task is enqueued.
>>
>> Use reservoir sampling for equal exit latencies, resetting the candidate
>> count when a shallower candidate appears. Use the per-CPU scheduler PRNG
>> and reciprocal_scale() to avoid variable division or a second scan.
>>
>> Use a u64 latency key with U64_MAX for unpublished states. Published
>> states take precedence; when none are found, sample among the idle CPUs
>> without a published state.
>>
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Thanks!
FWIW some additional thoughts, in case the unpublished idle state handling
does end up causing regressions (but for now fingers crossed!), there's
of course the option of trying to bucket them into "entering idle" and
"exiting idle" by putting a threshold on rq->idle_stamp.
I've experimented with this, but similarly how it didn't matter if
unpublished states are treated as ideal candidates or worst-idle candidates
this also didn't matter. Throughout various benchmarks about 0.1-0.5% of CPU
candidates are in unpublished state window and with them now counting as
U64_MAX exit_latency they end up being the best candidate of the scan only
extremely rarely (and conversely even rarer is the tie-break between two
unpublished-idle-state CPUs).
> [snip]
prev parent reply other threads:[~2026-09-21 15:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 15:39 [PATCH v2 0/2] sched/fair: Randomize equally shallow idle CPU picks Christian Loehle
2026-09-17 15:39 ` [PATCH v2 1/2] sched/fair: Drop idle recency from slow-path CPU selection Christian Loehle
2026-09-17 15:39 ` [PATCH v2 2/2] sched/fair: Randomize equally shallow slow-path candidates Christian Loehle
2026-09-17 16:06 ` Vincent Guittot
2026-09-18 11:43 ` Peter Zijlstra
2026-09-21 15:39 ` Christian Loehle [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=2d93f0c3-a3c6-4789-bd38-1b289634b8a2@arm.com \
--to=christian.loehle@arm.com \
--cc=beata.michalska@arm.com \
--cc=bsegall@google.com \
--cc=cl@gentwo.org \
--cc=daniel.lezcano@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=elif.topuz@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sh@gentwo.org \
--cc=shijie@os.amperecomputing.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®