Re: [PATCH v7 28/40] sched/deadline: Keep a task in the root domain that counts its bandwidth

From: Mathieu Desnoyers

Date: Wed Nov 18 2026 - 08:41:11 EST


> Does this leave p->wake_cpu stale when cpumask_any_and_distribute()
> already picked a dest_cpu inside span?

Yes. The stale wake_cpu matters only for a wakeup during the rebuild of
the sched domains. Outside it, select_task_rq_dl() prefers the span. The
cover letter lists the rebuild case as a known limit of this patch.

The next version still sets wake_cpu for a sleeping task whose new mask
keeps its CPU in the span, as you suggest. That narrows the window. It
does not close it: during a rebuild, find_later_rq() can still look in
another root domain. This was checked by reading.

> Can dl_task_offline_migration() still move a throttled task and its
> bandwidth into def_root_domain when dl_task_timer() fires during a
> sched domain rebuild?

Yes, thanks. Upstream makes the same move. But with this series, the
walk then counted the task on the isolated CPU, and kept it there. And
the cover letter says no bandwidth moves during the rebuild.

The next version uses the same test as migrate_task_rq_dl() and
task_woken_dl(), dl_bw_move_blocked(p). So dl_task_offline_migration()
moves no root domain bandwidth while the sched domains are rebuilt, or
before the walk counted the task. The bandwidth of the runqueue still
moves, since it follows the task. The walk counts the task on the side
of its record, and its next wakeup brings it back. The task itself may
still run on the isolated CPU until it blocks. That is the known limit
of this patch.

This was checked by reading, not reproduced.

> Should p->dl.dl_bw_cpu be read with READ_ONCE() when initializing
> recorded in dl_task_rebuild_cpu()?

Yes. The last schedule of a dying task can clear the record while the
walk holds only the pi_lock. The walk checks again under
dl_departed_lock, so the race is harmless. But the value must be read
once. The next version uses READ_ONCE(), in patch 26, where this line
comes from.

Thanks,

Mathieu

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