From: Peter Zijlstra <peterz@infradead.org>
To: Ahmed Abdelraoof <araoof@amazon.de>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
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>,
"Vineeth Pillai (Microsoft)" <vineethrp@gmail.com>,
Josh Don <joshdon@google.com>,
Ahmed Abdelraoof <araoof@amazon.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/core: keep offline cpus out of core-wide selections
Date: Mon, 2 Nov 2026 14:07:28 +0100 [thread overview]
Message-ID: <20261102130728.GI1813469@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261101221219.118052-1-araoof@amazon.de>
On Sun, Nov 01, 2026 at 10:12:18PM +0000, Ahmed Abdelraoof wrote:
> kernel/sched/core.c | 12 ++++++++++++
> kernel/sched/core_sched.c | 2 +-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d7c3b43158de..f55f6a0befcc 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6413,6 +6413,9 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> */
> max = NULL;
> for_each_cpu_wrap(i, smt_mask, cpu) {
> + if (!cpu_online(i))
> + continue;
> +
> rq_i = cpu_rq(i);
>
> /*
> @@ -6448,6 +6451,8 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> for_each_cpu(i, smt_mask) {
> rq_i = cpu_rq(i);
> p = rq_i->core_pick;
> + if (!p)
> + continue;
Can't you do what you do in the last hunk for all 3 cases? It seems
unfortunate to have 3 different ways to iterate in one patch.
>
> if (!cookie_equals(p, cookie)) {
> p = NULL;
> @@ -6760,6 +6765,13 @@ static inline void sched_core_cpu_dying(unsigned int cpu)
>
> if (rq->core != rq)
> rq->core = rq;
> +
> + /*
> + * Core-wide selections skip offline siblings and rely on a NULL
> + * core_pick to tell them apart from participants.
> + */
> + rq->core_pick = NULL;
> + rq->core_dl_server = NULL;
> }
>
> #else /* !CONFIG_SCHED_CORE: */
> diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
> index 43e0bde3038e..1efde88da76e 100644
> --- a/kernel/sched/core_sched.c
> +++ b/kernel/sched/core_sched.c
> @@ -273,7 +273,7 @@ void __sched_core_account_forceidle(struct rq *rq)
> delta = div_u64(delta, rq->core->core_forceidle_occupation);
> }
>
> - for_each_cpu(i, smt_mask) {
> + for_each_cpu_and(i, smt_mask, cpu_online_mask) {
> rq_i = cpu_rq(i);
> p = rq_i->core_pick ?: rq_i->curr;
>
> --
> 2.47.3
>
prev parent reply other threads:[~2026-11-02 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 22:12 Ahmed Abdelraoof
2026-11-02 13:07 ` Peter Zijlstra [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=20261102130728.GI1813469@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=araoof@amazon.com \
--cc=araoof@amazon.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vineethrp@gmail.com \
--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®