Re: [PATCH v10 05/40] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild
From: sashiko-bot
Date: Fri Nov 20 2026 - 16:12:54 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: missing sched_setaffinity() in
deadline_rebuild_test
--
commit f6538c4af07769165daa29a5b3577ecba3fd01c9
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild
This commit adds deadline_rebuild_test to verify that a SCHED_DEADLINE
task's remaining bandwidth before its 0-lag time is accounted properly
across root domain rebuilds and cpuset partition migrations.
> 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..85b24b868da72
> --- /dev/null
> +++ b/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c
[ ... ]
> +/*
> + * Pick the two highest online CPUs that are not isolated, for P and Q.
> + * Return the number of such CPUs.
> + */
> +static int pick_cpus(void)
> +{
> + static char online[CPU_SETSIZE], isol[CPU_SETSIZE];
> + char buf[4096];
> + int cpu, n = 0;
> +
> + if (read_file("/sys/devices/system/cpu/online", buf, sizeof(buf)))
> + return 0;
> + parse_cpulist(buf, online, CPU_SETSIZE);
> + if (!read_file("/sys/devices/system/cpu/isolated", buf, sizeof(buf)))
> + parse_cpulist(buf, isol, CPU_SETSIZE);
> + cpu_p = cpu_q = -1;
> + for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--) {
> + if (!online[cpu] || isol[cpu])
> + continue;
> + if (cpu_p < 0)
> + cpu_p = cpu;
> + else if (cpu_q < 0)
> + cpu_q = cpu;
> + n++;
> + }
> + return n;
> +}
[Severity: Low]
Should pick_cpus() or main() also call sched_setaffinity() to pin the test
process to the non-isolated online CPUs, as deadline_bw_test does?
On a system booted with isolcpus=domain, creating or removing partition
roots under the root cpuset resets tasks without a user affinity mask
(p->user_cpus_ptr) to all CPUs in the root cpuset, including the isolated
CPUs. In test_move(), departing(NULL, SWITCHED_OUT, fd) can then run on
an isolated CPU in def_root_domain rather than the housekeeping root
domain, causing set_deadline() to either fail or test bandwidth departure
from the wrong root domain.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795207232.git.mathieu.desnoyers@xxxxxxxxxxxx?part=5