Re: [PATCH v2 08/21] selftests/sched: Add a test of SCHED_DEADLINE policy round trips

From: Juri Lelli

Date: Thu Nov 05 2026 - 10:07:50 EST


Hello,

On 04/11/26 16:11, Mathieu Desnoyers wrote:
> Add deadline_switch_test, with a case for the fix two patches back and
> one for commit 41a7968022ca ("sched/deadline: Fix total_bw leak when
> switching away from SCHED_DEADLINE while !queued"):
>
> - throttled_round_trip: a task with a runtime of 10ms per 2s period
> spins, so that each replenishment throttles it again at once. Right
> after a throttle it is switched to SCHED_OTHER, and back 200us after
> its deadline: past its replenishment timer, and before its 0-lag
> time, which the overrun scaled by 200 puts later. It must run again
> within a period and a half. Three attempts;
> - asleep_round_trip: a task of 9ms every 10ms, running 0.2ms and
> sleeping 50ms, is switched to SCHED_OTHER and back while it sleeps
> past its 0-lag time, enough times that a leak of its bandwidth at
> each round trip fills the root domain: sched_setattr() then fails
> with EBUSY. Skipped without admission control (sched_rt_runtime_us
> at -1). A kernel that leaks is left without SCHED_DEADLINE bandwidth
> until a reboot, so this case runs last.
>
> In 8 VMs of 8 vCPUs each, v7.3 fails both cases, and v7.4-rc1 with the
> four deadline fixes of sched/urgent fails the first; with the two
> previous patches as well both pass; every time.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> ---

Thanks for the selftests! Very useful.

FWIW I did propose some already in the past, but then didn't get time/
tokens for a follow up:

https://lore.kernel.org/all/20260306-upstream-deadline-kselftests-v1-0-2b23ef74c46a@xxxxxxxxxx/

We can probably re-start the effort with yours and keep adding as
needed.

Do we want to have per-policy subdirs under sched?

Thanks,
Juri