Re: [PATCH v5 12/29] sched/deadline: Reject SCHED_DEADLINE on exited tasks
From: Juri Lelli
Date: Wed Nov 11 2026 - 02:05:08 EST
Hello,
On 08/11/26 13:53, Mathieu Desnoyers wrote:
> From: Juri Lelli <juri.lelli@xxxxxxxxxx>
>
> sched_setattr(SCHED_DEADLINE) on a zombie task succeeds and charges
> total_bw via sched_dl_overflow(), but the task has already done its
> final schedule() and will never run again. Nothing releases the reserved
> bandwidth. Repeating this fills total_bw to the admission cap, after
> which sched_setattr(SCHED_DEADLINE) and CPU offline fail with -EBUSY.
>
> Reject sched_setattr(SCHED_DEADLINE) on exited tasks with -ESRCH.
>
> A task of the class that exited, switched to another policy, runs
> switched_from_dl(), which decrements the count of deadline tasks of its
> cpuset that cgroup_task_dead() decremented already: at 0 with a deadline
> task left in it, the cpuset is skipped by the next rebuild of the root
> domains' accounting, and that task's bandwidth with it. Reject that as
> well. The deadline_bw_test selftest added later in this series has the
> case, death_zombie_switched: on v7.4-rc1 the switch is accepted, and
> the one-CPU partition root the zombie ran in admits 9 tasks of 10% after
> a rebuild, with a task of 30% still in it, where 6 are due.
>
> Fixes: 332ac17ef5bf ("sched/deadline: Add bandwidth management for SCHED_DEADLINE tasks")
> Reported-by: Weiheng Qiu <weihengqiuu@xxxxxxxxx>
> Closes: https://lore.kernel.org/all/3f6e6c87-645b-45fd-8fc6-8da5bc5b82d8@xxxxxxxxx/
> Link: https://lore.kernel.org/all/20261103-b4-sched-dl-bw-fixes-v1-4-dd761fe005b4@xxxxxxxxxx/
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Juri Lelli <juri.lelli@xxxxxxxxxx>
> [mathieu: reject a task of the class leaving it too, found by the
> Sashiko AI review of the patch]
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> ---
Looks good to me, thanks!
Best,
Juri