Re: [PATCH v12 05/43] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild

From: sashiko-bot

Date: Fri Nov 27 2026 - 10:16:40 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: SIGKILL before set_other() in reap() leaves DL
bandwidth
--

commit 0894b84fdb5ad0556ac423d675bc233e094e30da
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>

selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild

This commit adds the deadline_rebuild_test selftest to verify that
SCHED_DEADLINE bandwidth from tasks that exit or switch out before their
0-lag time is properly tracked across root domain rebuilds.

> diff --git a/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c b/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c
> new file mode 100644
> index 0000000000000..735c3c65e156a
> --- /dev/null
> +++ b/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c
> @@ -0,0 +1,587 @@
[ ... ]
> +static void reap(pid_t pid)
> +{
> + int status;
> +
> + if (pid <= 0)
> + return;
> + if (kill(pid, SIGKILL) && errno != ESRCH)
> + ksft_print_msg("kill %d: %s\n", pid, strerror(errno));
> + /* Ignore the result: the task may be dead already. */
> + set_other(pid);
> + while (waitpid(pid, &status, 0) != pid) {
> + if (errno == EINTR)
> + continue;
> + ksft_print_msg("waitpid %d: %s\n", pid, strerror(errno));
> + break;
> + }
> +}

[Severity: Low]
Can calling kill(pid, SIGKILL) before set_other(pid) leave the 600ms/s
bandwidth of task 'a' from check_p() allocated past the end of the test
case?

In check_p(), task 'a' is switched to SCHED_DEADLINE while sleeping in
pause(), so its deadline and runtime are still 0. Waking it with SIGKILL
before switching it to SCHED_OTHER starts a new deadline period on cpu_p;
if task 'a' runs for any non-zero time before set_other() or do_exit()
dequeues it, its 0-lag time becomes positive and its 600ms/s bandwidth is
held until the inactive timer fires. Because test_rebuild() sets ran = 0
before calling check_p(), it proceeds directly to the next test case
without waiting for that timer, which can cause the next case's 400ms/s
admission on cpu_p to fail with EBUSY.

Calling set_other(pid) before kill(pid, SIGKILL) switches the sleeping task
back to SCHED_OTHER while its deadline is still 0, releasing its bandwidth
immediately.

--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795771147.git.mathieu.desnoyers@xxxxxxxxxxxx?part=5