From 2c91169377f44e2f2b0b79bc0365f0722987a650 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 21 Jul 2026 11:25:14 -1000 Subject: [PATCH] sched_ext: Blame the DSQ's owning scheduler for a runnable stall check_rq_for_timeouts() blames a runnable stall on the task's owner. Under a sub-scheduler hierarchy the stalled task can be sitting on a DSQ that a different scheduler has to drain, e.g. an ancestor's bypass DSQ while the owner is bypassing. The drainer then escapes blame while the owner is exited, and when the owner's exit is already claimed, nothing actionable is reported at all. Blame the DSQ's owning scheduler instead. The local DSQ is consumed by the cpu itself and keeps blame on the owner. Detection keeps the owner's timeout and single-scheduler behavior is unchanged. Reviewed-by: Andrea Righi Signed-off-by: Tejun Heo --- kernel/sched/ext/ext.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index b730eac4b13f..96389ec31ab8 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -3391,8 +3391,19 @@ static bool check_rq_for_timeouts(struct rq *rq) if (unlikely(time_after(jiffies, last_runnable + READ_ONCE(sch->watchdog_timeout)))) { + struct scx_dispatch_q *dsq = READ_ONCE(p->scx.dsq); u32 dur_ms = jiffies_to_msecs(jiffies - last_runnable); + /* + * A task can be stuck on a DSQ that a sched other than + * its owner is responsible for draining, e.g. an + * ancestor's bypass DSQ while the owner is bypassing. + * Blame the drainer. The local DSQ is consumed by the + * cpu itself and keeps blame on the owner. + */ + if (dsq && dsq->sched && dsq->id != SCX_DSQ_LOCAL) + sch = dsq->sched; + __scx_exit(sch, SCX_EXIT_ERROR_STALL, 0, cpu_of(rq), "%s[%d] failed to run for %u.%03us", p->comm, p->pid, dur_ms / 1000,