Re: [PATCH v14 37/39] sched/deadline: Warn when a runqueue keeps the bandwidth of a task
From: sashiko-bot
Date: Thu Dec 03 2026 - 13:05:34 EST
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] sched/deadline: Cold p->dl load in set_task_cpu() on non-DL
migrations
- [Low] sched/deadline: Changelog cites __dl_clear_params() not
dl_release_params()
--
commit c63aaa2809cc1d85748f1c6385d4f67c969d9e4e
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
sched/deadline: Warn when a runqueue keeps the bandwidth of a task
This commit adds WARN_ON_ONCE() checks in set_task_cpu(),
task_non_contending(), and inactive_task_timer() to catch cases where
dl_bw_oncpu remains set after a task leaves the deadline class or before
its deadline parameters are released.
> - task_non_contending() or inactive_task_timer() releases the
> bandwidth of a task while its flag is still set. They then call
> __dl_clear_params(), which clears both the flag and dl_bw. After
> that, nothing can take the bandwidth off the runqueue.
[ ... ]
> Warn about the first state in set_task_cpu(). Warn about the second
> in task_non_contending() and inactive_task_timer(), before they call
> __dl_clear_params(). No warning fires in the selftests of this series.
[Severity: Low]
Both task_non_contending() and inactive_task_timer() actually call
dl_release_params(), which invokes __dl_clear_params() internally and
preserves period_start and deadline for constrained-deadline tasks.
Should the changelog refer to dl_release_params() instead?
[ ... ]
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 2700c8e98b0ed..879ac7d6cdfd0 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3517,6 +3517,9 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
> */
> WARN_ON_ONCE(!cpu_online(new_cpu));
>
> + /* A task of another class would leave its bandwidth in this_bw. */
> + WARN_ON_ONCE(!dl_task(p) && p->dl.dl_bw_oncpu);
[Severity: Medium]
Does this unconditionally load a cold cacheline in p->dl on every
non-deadline task migration?
set_task_cpu() runs on hot paths such as try_to_wake_up() and
detach_task(), under p->pi_lock or rq->__lock with IRQs disabled.
Non-deadline paths do not otherwise touch p->dl, so reading dl_bw_oncpu
adds a cold cacheline load on every migration even without deadline tasks.
Checking here also only fires belatedly on an unrelated migration trace,
misses tasks that stay on one CPU, and is compiled out without CONFIG_SMP.
Checking WARN_ON_ONCE(p->dl.dl_bw_oncpu) in switched_from_dl(), where
p->dl is already hot in cache, or gating this check behind
CONFIG_SCHED_DEBUG would avoid penalizing non-deadline migrations while
catching class-exit leaks at the source.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796296313.git.mathieu.desnoyers@xxxxxxxxxxxx?part=37