[PATCH v34 04/14] sched/proxy: Wake blocked RT and deadline tasks through the full path

From: John Stultz

Date: Tue Dec 01 2026 - 22:53:38 EST


From: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

With proxy execution, a task blocked on a mutex stays on its runqueue.
The RT and deadline classes do not put such a task on their pushable
lists. enqueue_task_rt() and put_prev_task_rt() skip a blocked task.
enqueue_task_dl() and put_prev_task_dl() do the same. find_proxy_task()
migrates it instead.

Commit 7918cf369361 ("sched/proxy: Only return migrate when needed")
wakes a blocked task in place when it is still on its original CPU.
That wake-up does no enqueue. It also skips select_task_rq() and the
task_woken() method of the class. So the woken task is runnable, but it
is not pushable, and no other CPU can pull it.

A SCHED_FIFO task woken this way waits behind a higher priority task
while another CPU is idle. In a test on two CPUs, it ran 500ms after
the mutex was released, when the higher priority task stopped. Without
proxy execution it ran at once on the idle CPU. The test uses
SCHED_FIFO. The deadline class has the same code path.

Fix this in proxy_needs_return(). An RT or deadline task takes the full
wake-up path, as a task that was proxy-migrated does. The other classes
keep the in-place wake-up.

Fixes: 7918cf369361 ("sched/proxy: Only return migrate when needed")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
[jstultz: Simplified the conditional check a touch]
Signed-off-by: John Stultz <jstultz@xxxxxxxxxx>
---
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: K Prateek Nayak <kprateek.nayak@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
Cc: Suleiman Souhlal <suleiman@xxxxxxxxxx>
Cc: Andrea Righi <arighi@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Metin Kaya <Metin.Kaya@xxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Zimuzo Ezeozue <zezeozue@xxxxxxxxxx>
Cc: Waiman Long <longman@xxxxxxxxxx>
Cc: Boqun Feng <boqun.feng@xxxxxxxxx>
Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx>
Cc: Joel Fernandes <joelagnelf@xxxxxxxxxx>
Cc: Qais Yousef <qyousef@xxxxxxxxxxx>
Cc: Xuewen Yan <xuewen.yan94@xxxxxxxxx>
Cc: kuyo chang <kuyo.chang@xxxxxxxxxxxx>
Cc: hupu <hupu.gm@xxxxxxxxx>
Cc: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
Cc: zhidao su (Xiaomi) <soolaugust@xxxxxxxxx>
Cc: Hui Su <sh_def@xxxxxxx>
Cc: Shubhang Kaushik (Ampere) <sh@xxxxxxxxxx>
Cc: kernel-team@xxxxxxxxxxx
---
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 9ba25925c928a..eb2ab495f1df0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3875,8 +3875,13 @@ static inline bool proxy_needs_return(struct rq *rq, struct task_struct *p)
* only set p->wake_cpu when !p->on_rq, and since here p->on_rq, this
* will not apply. But if it did, this check is the safe way around
* and would migrate.
+ *
+ * The RT and deadline classes place a task at wake-up:
+ * select_task_rq(), the pushable list, a push to another CPU. An
+ * in-place wake-up skips all of that. So their tasks take the full
+ * wake-up path too.
*/
- if (task_cpu(p) == p->wake_cpu)
+ if (task_cpu(p) == p->wake_cpu && !rt_or_dl_task(p))
return false;

scoped_guard(raw_spinlock, &p->blocked_lock) {
--
2.56.1.911.g883d8bcb20-goog