Linux SCHED_DEADLINE gets 25 bandwidth accounting fixes
Mathieu Desnoyers’s series stops over-admission, lockups, and three kernel crashes in the deadline scheduler, and ships the first dedicated selftests.
Mathieu Desnoyers has posted a 29-part series that repairs 25 bugs in the Linux kernel’s SCHED_DEADLINE class, most of them in how the scheduler accounts reserved CPU bandwidth. Three of the defects can take the kernel down; two can leave cpuset locking unusable. The rest leave root-domain or per-runqueue bandwidth totals wrong, so admission control either accepts more deadline work than the machine can guarantee or refuses every new deadline task.
SCHED_DEADLINE is the kernel’s hard real-time policy: tasks declare runtime and period, and the scheduler admits them only when the aggregate reservation still fits. When totals drift after hotplug, cpuset moves, priority inheritance, policy switches, or task exit, that safety net fails silently until the next full rebuild. In testing, a one-CPU partition could admit two 600 ms/s tasks where it had room for one; other races left destination domains short of reserved bandwidth or drove totals below zero so every later deadline request failed with EBUSY.
The series restores correct accounting across departures that linger until 0-lag, offline-domain rebuilds (with and without cpusets), attach races against sched-domain rebuilds, isolcpus layouts that span multiple root domains, offline migration via fallback CPU selection, leftover replenishment timers after leaving the class, and this_bw updates for sleeping tasks boosted into deadline by priority inheritance. One fix, originally from Andrea Parri, stops a double unlock of cpuset_mutex on sched_setscheduler retry paths. Earlier urgent fixes that had been dropped after a hotplug crash are reworked and reintroduced; board testing that previously failed now passes.
Desnoyers also exposes each runqueue’s this_bw and running_bw in sched_debug (values GRUB reclaiming depends on) and adds the first upstream selftests for the class: deadline_switch_test covers throttled and asleep policy round-trips plus sysrq-n edge cases, and deadline_bw_test runs dozens of admission, hotplug, cpuset, PI, and reclaim scenarios that previously had no automated coverage. The first 25 patches are ordered for stable backports. Automated review of the posting flagged a few remaining medium-severity PI deboost and rebuild corner cases still under consideration.