Re: [PATCH v12 30/43] sched/deadline: Start a period for a task that enters the class blocked

From: sashiko-bot

Date: Fri Nov 27 2026 - 12:17:18 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/deadline: missing dl_boost_blocked() call in
__setscheduler_dl_pi()
--

commit 5b744c28d31fd000da17d32b4f44f2734f91f651
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

sched/deadline: Start a period for a task that enters the class blocked

This commit starts a deadline period for a task blocked on an rt_mutex
when it enters SCHED_DEADLINE via sched_setattr() or when a priority
inheritance boost gives it a new deadline donor, so that the rt_mutex
chain walk sorts its waiter using a valid deadline rather than 0.

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7a3a7e755d20b..edd26b321feeb 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7980,8 +7980,12 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
> if (!dl_prio(p->normal_prio) ||
> (pi_task && dl_prio(pi_task->prio) &&
> dl_entity_preempt(&pi_task->dl, &p->dl))) {
> + struct sched_dl_entity *old_donor = p->dl.pi_se;
> +
> dl_set_donor(&p->dl, pi_task);
> scope->flags |= ENQUEUE_REPLENISH;
> + if (!scope->queued && p->dl.pi_se != old_donor)
> + dl_boost_blocked(p);
> } else {
> dl_deboost(&p->dl);
> /*

[Severity: Medium]
Should __setscheduler_dl_pi() also call dl_boost_blocked(p) when
!scope->queued and p->dl.pi_se changes?

kernel/sched/syscalls.c:__setscheduler_dl_pi() {
...
if (dl_prio(newprio) && !dl_policy(policy)) {
struct task_struct *pi_task = rt_mutex_get_top_task(p);

if (pi_task) {
dl_set_donor(&p->dl, pi_task);
scope->flags |= ENQUEUE_REPLENISH;
}
}
...
}

If p is blocked on an rt_mutex while already boosted in dl_sched_class by
an earlier deadline donor, and a new top waiter boosts p's lock waiter M,
__sched_setscheduler() on p can run before M's preemptible chain walk
reaches p. __setscheduler_dl_pi() then updates p->dl.pi_se to the new
donor without replenishing p->dl.deadline (since p is not queued and stays
in dl_sched_class, neither enqueue nor switched_to_dl() runs).
rt_mutex_adjust_pi(p) copies the new pi_se with the old donor's deadline
into p's waiter, and when M's chain walk reaches rt_mutex_setprio(p, M),
p->dl.pi_se == old_donor is already true, so dl_boost_blocked(p) is
skipped there as well and p's waiter stays sorted by the previous donor's
stale deadline.

--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795771147.git.mathieu.desnoyers@xxxxxxxxxxxx?part=30