Re: [PATCH v4 08/26] sched/deadline: Take a deadline boost from the waiter's rt_mutex node

From: sashiko-bot

Date: Fri Nov 06 2026 - 21:32:02 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/deadline: missing reset of dl_boosted in
__sched_setscheduler()
--

commit 58101a4480d1230ff10b589ddb99ec9388dce3f3
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

sched/deadline: Take a deadline boost from the waiter's rt_mutex node

This commit records a deadline waiter's reservation parameters in its
rt_mutex_waiter node under pi_lock and copies them into the boosted owner's
sched_dl_entity so replenishment does not spin if the waiter leaves
SCHED_DEADLINE before the PI chain walk completes.

> diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
> index c3f404cddb9e7..89c185f7d4980 100644
> --- a/kernel/sched/syscalls.c
> +++ b/kernel/sched/syscalls.c
> @@ -297,10 +297,10 @@ static inline void __setscheduler_dl_pi(int newprio, int policy,
> */
>
> if (dl_prio(newprio) && !dl_policy(policy)) {
> - struct task_struct *pi_task = rt_mutex_get_top_task(p);
> + const struct sched_dl_params *params = rt_mutex_top_dl_params(p);
>
> - if (pi_task) {
> - p->dl.pi_se = pi_task->dl.pi_se;
> + if (params) {
> + dl_boost(&p->dl, params);
> scope->flags |= ENQUEUE_REPLENISH;
> }
> }

[Severity: Medium]
Can __sched_setscheduler() leave p->dl.dl_boosted set when a task boosted by
a deadline waiter changes its own scheduling policy or parameters?

If a task holding an rt_mutex with a deadline waiter switches its own policy
to SCHED_DEADLINE with an earlier deadline than the waiter's, __setparam_dl()
updates p->dl.dl_runtime, dl_deadline, and dl_period without clearing
p->dl.dl_boosted, and __setscheduler_dl_pi() does nothing because
dl_policy(policy) is true. The task continues to run on the waiter's
pi_params and skips setup_new_dl_entity() in enqueue_dl_entity() until unlock.

Similarly, if normalize_rt_tasks() resets a deadline-boosted non-deadline task
to SCHED_NORMAL with pi == false, switched_from_dl() skips __dl_clear_params()
because p->dl.dl_runtime is 0, and __setscheduler_dl_pi() does nothing because
!dl_prio(newprio). When the task later unlocks the rt_mutex,
rt_mutex_setprio() sees prio == p->prio and !dl_prio(prio) and returns at
out_unlock without clearing p->dl.dl_boosted, leaving is_dl_boosted(&p->dl)
permanently true if the task later enters SCHED_DEADLINE.

--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107014451.1487825-1-mathieu.desnoyers@xxxxxxxxxxxx?part=8