Re: [PATCH v9 28/33] selftests/sched: Test deadline boosts in deadline_bw_test

From: sashiko-bot

Date: Fri Nov 20 2026 - 09:26:51 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: asleep_donor() 1s period in
deboost_out_asleep_after_refill() outlasts 300ms probe wait
--

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

selftests/sched: Test deadline boosts in deadline_bw_test

This commit adds eight test cases to deadline_bw_test covering SCHED_DEADLINE
priority inheritance boost and deboost scenarios, runtime refills from a
donor, and waiter ordering on PI locks.

> diff --git a/tools/testing/selftests/sched/deadline/deadline_bw_test.c b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> index 25fbbc3e88d00..5ea9bfe0aee2c 100644
> --- a/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> +++ b/tools/testing/selftests/sched/deadline/deadline_bw_test.c

[ ... ]

> @@ -1938,6 +2065,326 @@ static int deboost_keeps_own_runtime(void)
> return ret;
> }
>
> +/* Run refill_case() with an owner that is refilled from its donor. */

[ ... ]

> +static void *asleep_donor(void *arg)
> +{
> + struct timespec ts;
> + int err;
> +
> + aslp_donor_tid = gettid_();
> + err = set_deadline(0, NSEC_PER_MSEC, NSEC_PER_SEC);
> + sem_post(&aslp_donor_ready);
> + if (err) {
> + ksft_print_msg("the donor refused as a deadline task: %s\n", strerror(-err));
> + return (void *)1;
> + }
> + if (sem_wait_for(&aslp_owner_locked, 5000)) {
> + ksft_print_msg("the owner did not take the lock\n");
> + return (void *)1;
> + }
> + clock_gettime(CLOCK_REALTIME, &ts);
> + ts.tv_nsec += 200 * 1000000L;
> + ts.tv_sec += ts.tv_nsec / 1000000000L;
> + ts.tv_nsec %= 1000000000L;
> + aslp_donor_locking = 1;
> + err = pthread_mutex_timedlock(&pi_lock, &ts);
> + aslp_total_bw = total_bw_of(top_cpu(1));

[Severity: Low]
Can asleep_donor()'s 1s period outlast the 300ms wait in measured(), causing
probe() to fail with a false bandwidth leak?

asleep_donor() runs with a 1ms runtime and 1s period (a 1000:1 ratio).
Its initial 0-lag time passes during the 200ms timedlock sleep, so waking
on timeout replenishes a new 1s period. It then calls total_bw_of(), which
reads /sys/kernel/debug/sched/debug while still in SCHED_DEADLINE. Each
microsecond of CPU time spent there pushes its 0-lag time forward by 999us,
so spending more than ~300us leaves its bandwidth active past the 3 * PERIOD
(300ms) sleep in measured(), and probe(cg_p) admits 8 tasks instead of 9.

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