From: "tip-bot2 for Fernand Sieber" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Fernand Sieber <sieberf@amazon.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, <stable@vger.kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick
Date: Sun, 22 Nov 2026 22:49:29 -0000 [thread overview]
Message-ID: <179538776931.92412.14044843169789564901.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20261112161548.78189-2-sieberf@amazon.com>
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 5b65edb7f582803cda84552990779610ca22581c
Gitweb: https://git.kernel.org/tip/5b65edb7f582803cda84552990779610ca22581c
Author: Fernand Sieber <sieberf@amazon.com>
AuthorDate: Thu, 12 Nov 2026 18:15:44 +02:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Sun, 22 Nov 2026 16:16:27 +01:00
sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick
With core scheduling and the fair server, the forced-idle accounting
warns from an idle core:
WARNING: kernel/sched/core_sched.c:263 at __sched_core_account_forceidle+0x1d6/0x1f0, CPU#0: swapper/0/0
The core is in forced idle with no sibling running a task. The reason
is a stale rq->dl_server causing the idle task to incorrectly be
considered as carried by the deadline server. The idle task then wins
over a runnable sibling task and the whole core is idle despite having
runnable tasks.
The timeline below describes the issue:
Setup. CPU0 and CPU1 are SMT siblings.
- CPU1 runs R, a SCHED_FIFO task with cookie X.
- CPU0 has C, a CFS task with no cookie, which has been starved.
So CPU0's fair server is due to step in.
t0, CPU0 picks for the core.
- pick_task(rq0) goes through the deadline class, which picks the
fair server, which picks C. As a side effect it sets
rq0->dl_server = &rq0->fair_server.
- pick_task(rq1) picks R.
t1, ranking. C->dl_server is only set once C is switched in, so C
ranks as CFS. R (RT) beats C (CFS), so the core cookie becomes X.
t2, matching. CPU0's pick C has cookie 0, not X, so it is replaced.
There is no cookie-X task on CPU0, so the replacement is idle, and
CPU0 is forced idle.
- The code sets rq0->core_pick = idle and rq0->core_dl_server = NULL.
- The bug: it leaves rq0->dl_server pointing at CPU0's fair server,
even though idle didn't come through any server.
t3, CPU0 switches. CPU0 is the selecting CPU, so next = idle, and
put_prev_set_next_task() hands the stale rq0->dl_server to it. Now
idle->dl_server is CPU0's fair server.
t4, C leaves. Load balancing moves C to another core, so CPU0 has
nothing runnable. The stale link stays on idle.
t5, the next core-wide selection (when CPU1 reschedules, say on a
wakeup).
- CPU0's pick is idle, and the ranking sees idle->dl_server set, so
it ranks idle as a deadline task.
- idle now beats R, and the core cookie becomes idle's cookie, 0.
- CPU1's R has cookie X, not 0, so CPU1 is forced idle.
t6, result. The whole core is idle. R is runnable but can't run, and
nothing runs on either CPU. That's the WARN in
__sched_core_account_forceidle(): forced idle with no sibling running
a task. It lasts until CPU0 goes through a full schedule that resets
its server link.
With this patch, step t2 also does rq0->dl_server = NULL. At t3 idle
gets no server, and at t5 it ranks as plain idle, so R wins and keeps
running on CPU1.
Fixes: bd9bbc96e835 ("sched: Rework dl_server")
Signed-off-by: Fernand Sieber <sieberf@amazon.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://patch.msgid.link/20261112161548.78189-2-sieberf@amazon.com
---
kernel/sched/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 515b9d0..42b99be 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6453,10 +6453,15 @@ restart:
p = sched_core_find(rq_i, cookie);
if (!p)
p = idle_sched_class.pick_task(rq_i, rf);
+
+ /*
+ * Neither a core tree pick nor idle comes through a
+ * DL server; drop the one the replaced pick left.
+ */
+ rq_i->core_dl_server = rq_i->dl_server = NULL;
}
rq_i->core_pick = p;
- rq_i->core_dl_server = NULL;
if (p == rq_i->idle) {
if (rq_i->nr_running) {
next prev parent reply other threads:[~2026-11-22 22:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 16:15 [PATCH 0/5] sched: Fix DL server starvation under core scheduling Fernand Sieber
2026-11-12 16:15 ` [PATCH 1/5] sched/core: Clear stale rq->dl_server when core-sched replaces a pick Fernand Sieber
2026-11-22 22:49 ` tip-bot2 for Fernand Sieber [this message]
2026-11-23 9:44 ` [tip: sched/urgent] sched/deadline: " tip-bot2 for Fernand Sieber
2026-11-12 16:15 ` [PATCH 2/5] sched/core: Keep a sibling's DL server link in the core-wide pick Fernand Sieber
2026-11-18 13:50 ` Peter Zijlstra
2026-11-18 13:58 ` Peter Zijlstra
2026-11-12 16:15 ` [PATCH 3/5] sched/core: Rank DL server picks as deadline " Fernand Sieber
2026-11-18 13:52 ` Peter Zijlstra
2026-11-23 9:55 ` [tip: sched/core] " tip-bot2 for Fernand Sieber
2026-11-12 16:15 ` [PATCH 4/5] sched/deadline: Don't charge core-sched forced idle to the DL servers Fernand Sieber
2026-11-22 22:49 ` [tip: sched/urgent] " tip-bot2 for Fernand Sieber
2026-11-23 9:44 ` tip-bot2 for Fernand Sieber
2026-11-12 16:15 ` [PATCH 5/5] selftests/sched: Add a core-sched forced-idle DL server test Fernand Sieber
2026-11-22 22:49 ` [tip: sched/urgent] " tip-bot2 for Fernand Sieber
2026-11-23 15:37 ` Fernand Sieber
2026-11-23 9:44 ` tip-bot2 for Fernand Sieber
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=179538776931.92412.14044843169789564901.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sieberf@amazon.com \
--cc=stable@vger.kernel.org \
--cc=x86@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®