Re: [PATCH v5 11/29] sched/deadline: Release the bandwidth of a task that leaves the class asleep

From: Mathieu Desnoyers

Date: Tue Nov 10 2026 - 15:50:16 EST


On 2026-11-10 14:47, Juri Lelli wrote:
[...]
The fix looks right, but I wondered if we can condense a bit the above
if-else tree. It's essantially doing what task_non_contending() does
already (special and non-DL tasks checks included)?

What about something like

if (!task_on_rq_queued(p)) {
if (p->dl.dl_non_contending)
sub_running_bw(&p->dl, &rq->dl);
sub_rq_bw(&p->dl, &rq->dl);

if (!p->dl.dl_non_contending)
task_non_contending(&p->dl, false);
}

I ran the same collapse on top of the series and it passed the selftests
with LOCKDEP w/o warnings.

Good idea, thanks. I checked it against the series, at this patch and
at its end. task_non_contending() makes the same checks, and its two
paths are the two branches I open-coded. Your order also matters:
sub_rq_bw() must come before the clear of the parameters, which sets
dl_bw to 0.

v6 will take your version. Four later patches of the series change that
branch too. In v6, they will change task_non_contending() only.

Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com