Re: [PATCH v8 14/33] sched/deadline: Move a task's bandwidth to the root domain it runs in
From: Mathieu Desnoyers
Date: Fri Nov 20 2026 - 08:51:43 EST
> Can dl_bw_move_blocked() prevent a task that dl_add_task_root_domain()
> already visited and skipped from adding its bandwidth when it falls back
> to an active CPU before the tasklist walk finishes?
Yes, by reading. The walk and the wakeup both take the pi_lock, so your
order can happen. It needs a task with no active CPU in its mask or in
its cpuset. The task then runs uncounted until its next wakeup or
migration, or the next rebuild.
v9 will stamp a task that the walk leaves out, in a new field,
dl_bw_skip_gen. dl_bw_move_blocked() will not block a stamped task. The
offline migration of patch 15 has the same gap: the stamp will fix it
too.
> Can dl_task_bw_elsewhere() and dl_task_move_bw() move the departing
> bandwidth of a non-deadline task that is PI-boosted back into
> dl_sched_class before its 0-lag time?
They can, and this is intended. switched_to_dl() takes such a task off
the departed list. The inactive timer then no longer releases its
bandwidth. The task is a member of the class again. So this patch counts
its bandwidth where it runs, as for any deadline task.
The comment you quote in switched_to_dl() is wrong after this patch,
though. The bandwidth stays with the recorded CPU only until the next
wakeup or migration. v9 will fix the comment.
> If a task sleeps inside a migrate_disable() section on an active CPU while
> its affinity and bandwidth move to another root domain, does
> task_woken_dl() move the bandwidth back to the old root domain when the
> task wakes up on its pinned CPU?
Yes, by reading. It is most likely on PREEMPT_RT, where a spinlock_t
sleeps with migration disabled. In v9, dl_task_bw_elsewhere() will
return false for a CPU outside the mask of the task. The bandwidth will
then stay where the attach reserved it. migrate_enable() will move the
task there.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com