From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Juri Lelli <juri.lelli@redhat.com>
Cc: peterz@infradead.org, mingo@redhat.com,
vincent.guittot@linaro.org, tglx@kernel.org, will@kernel.org,
boqun@kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, luca.abeni@santannapisa.it,
tommaso.cucinotta@gmail.com, mathieu.poirier@linaro.org,
longman@redhat.com, ridong.chen@linux.dev, tj@kernel.org,
hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org,
bigeasy@linutronix.de, clrkwllms@kernel.org,
parri.andrea@gmail.com, m.szyprowski@samsung.com,
kayracizmeci@gmail.com, weihengqiuu@gmail.com,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v12 00/43] sched/deadline: bandwidth accounting fixes and selftests
Date: Tue, 1 Dec 2026 10:06:26 -0500 [thread overview]
Message-ID: <f897938f-65a0-418a-b1dd-360291185102@efficios.com> (raw)
In-Reply-To: <aw2vPl8O-LffQ-33@jlelli-thinkpadt14gen4.remote.csb>
On 2026-11-30 12:15, Juri Lelli wrote:
> To set expectations: I have roughly a week's worth of work left before
> the holiday break :)), and I'll probably spend it on what looks highest
> priority, the crash and hang fixes (23, 27, and 20 with them) plus 25
> and 26 for the first series.
Thanks, that helps. v13 starts with the five patches of your list. They
come in your order: 23, 27, 20, 25 and 26. They apply on the first
series alone.
> The rtmutex/PI part makes me a bit nervous. Beyond the memory safety and
> hang fixes, it grows DEADLINE PI quite a bit (held boosts, donor
> periods, an irq_work calling rt_mutex_setprio() from hard irq context),
> while proxy execution is meant to replace this code. I'd rather keep
> changes there to what is needed for correctness and weigh the rest
> against that, and it will need Peter's and Thomas' eyes anyway.
Understood. The rtmutex and PI changes move out of v13, into a new PI
series for Peter and Thomas. I will post it next, on top of v13. 40
moves with them, since it must come after 38 and 39. One test case of
the PI series also needs 22, which goes to my rtmutex series (see
below). Of the PI changes, v13 keeps only 23 and 27, the memory safety
and hang fixes.
Each fix that moves out fixes a bug. Its message names the test case,
reproducer, model or reading that shows it. The bugs are of these
kinds:
- A task runs on more than its reservation. Other deadline tasks can
then miss their deadlines (28, the part of 37 for a boosted task, 40
and 41).
- A deadline waiter waits for the next period of an owner that cannot
run, and can miss its deadline (38 and 39).
- A waiter with a deadline of 0, or one that has passed, takes the lock
before waiters with earlier deadlines (30 and 32).
- this_bw or total_bw counts a boosted task wrongly. A warning fires,
or sched_setattr() refuses a task that fits (29 and 31).
- In a lock cycle, rt_mutex_setprio() can make a task with no deadline
policy its own donor. The task would then not run again until its
priority changes (part of 38).
- A chain walk stops too early. The owner at the end of the chain keeps
an old donor, with a later deadline, while a deadline task waits for
it (21).
The held boosts and the donor periods are what the fixes of 28 and 38
need. The irq_work is what 39 needs. The code that throttles the owner
holds the rq lock. rt_mutex_setprio() needs the owner's pi_lock,
which nests outside the rq lock. If you or Peter would rather leave
some of these bugs to proxy execution, I will drop those patches.
> 22 also
> looks like an old RT priority bug that might be worth sending out
> separately?
Yes. It does not need deadline tasks. With SCHED_FIFO waiters, an owner
further down the chain keeps the old RT priority. I will move it to my
series "locking/rtmutex: priority inheritance fixes and tests", with a
SCHED_FIFO test case.
> On the accounting side, I've been playing with a different approach:
> keep the bandwidth of each task in a per-CPU sum (on the CPU recorded
> with it), so that a rebuild only sums the CPUs of each root domain.
[...]
> It's
> still WIP; I'll try to post it as an RFC, most likely in January, so
> that we can compare, if you are up for it?
Yes, I am. The test cases of deadline_bw_test and
deadline_rebuild_test should help to compare the two.
v13 adds three fixes that are more cases to compare. They are in the
departed list and the rebuild:
- v13 patch 31: a task leaves the class while a rebuild walks the task
list.
- v13 patch 32: a boost brings a departed task back into the class,
after a rebuild dropped its bandwidth.
- v13 patch 33: a task is reaped before its last schedule.
In each case, total_bw would miss the bandwidth of the task for a
while. Admission control could then accept too much. Reading the code
and a Spin model of the accounting found them. v13 patch 35 adds test
cases for the first two.
> > Ingo, Juri, a question on patches 25 and 26. Would you rather have
> > them in the first series, after its patch 10?
>
> Either way works for me, as long as they come right after it: as I said
> on 25, at the top of the next version (with 23 and 27) is fine too. I
> think 26 first needs a fix for the race Sashiko reported (its first two
> findings on 26 look right to me).
I agree, and v13 fixes both, in its patch 5. In both, the handler of
the inactive timer is running, so the timer cannot be canceled:
- The first finding: the new flag dl_inactive_pending tells whether the
handler will still release the bandwidth or restart the timer. If it
will, task_non_contending() leaves the task to the handler.
- The second finding: the restarted timer can fire after the task came
back to the class. The next task_non_contending() cancels it, as in
v12. If the timer fires before that, the handler now leaves the task
alone, since dl_non_contending is clear. This also fixes the third
finding, the bandwidth left in running_bw and this_bw at exit.
26 no longer calls dl_task_depart(), so it needs none of 1 to 19. With
the fix of the first finding, 26 leaves some departing tasks to the
timer handler. 1 adds the departed list. It now comes after 26, as v13
patch 6, and puts these tasks on the list.
> > Peter, Juri, a question on patch 37. Would you take a follow-up for
> > tasks with an implicit deadline?
>
> I think so, it's what the XXX in sched_dl_overflow() asks for.
Thanks. v13 does not include it.
> > Peter, Juri, a question on patch 37. It is large: it adds about 600
> > lines. [...] Would you like it split?
>
> I'd find it easier to review split, yes. The period_start /
> dl_next_period() part, for instance, looks like it could stand alone.
OK, v13 splits it, as patches 28 and 29. But dl_next_period() cannot
count from period_start in the first patch. That change alone makes
three cases of deadline_bw_test fail: wake_after_deadline_shrunk,
period_shrunk_no_burst and constrained_after_job. In each, the task has
run in its period when sched_setattr() lowers dl_deadline. The job that
ran counts as a job of the new parameters, released at
deadline - dl_deadline. Its next period starts one dl_period later.
The deadline still comes from the old dl_deadline, so this is later
than period_start + dl_period. The rule that keeps the debt gives this
later start. Today's formula, deadline - dl_deadline + dl_period,
happens to give it too. So the first patch only records period_start.
The second applies the rule, and computes dl_next_period() from
period_start. The part for a boosted task goes to the PI series, since
it builds on the held boost.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
prev parent reply other threads:[~2026-12-01 15:06 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 14:35 [PATCH v12 00/43] sched/deadline: bandwidth accounting fixes and selftests Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 01/43] sched/deadline: Keep departing bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 02/43] sched/deadline: Rebuild the root domains' accounting from the task list Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 03/43] sched/deadline: Record the root domain holding a task's bandwidth Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 04/43] sched/deadline: Leave a dying task out of a rebuild of the accounting Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 05/43] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 06/43] selftests/sched: Test the root domain rebuild in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 07/43] sched/deadline: Move a task's bandwidth only where room was made Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 08/43] cgroup/cpuset: Wait for an attach before rebuilding the sched domains Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 09/43] sched: Make deadline policy and affinity changes wait for a cpuset attach Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 10/43] cgroup/cpuset: Give back the bandwidth an attach did not move Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 11/43] cgroup/cpuset: Reserve the bandwidth in the root domain a task moves to Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 12/43] selftests/sched: Test cpuset moves in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 13/43] sched/deadline: Make a rebuild count a task in the root domain it runs in Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 14/43] sched/deadline: Move a task's bandwidth to " Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 15/43] sched/deadline: Keep a task in the root domain that counts its bandwidth Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 16/43] sched/deadline: Keep the last CPU a task has in its root domain Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 17/43] cgroup/cpuset: Refuse to take a deadline task out of " Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 18/43] selftests/sched: Test the root domain of a task in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 19/43] sched/deadline: Count only active CPUs when spreading extra_bw Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 20/43] sched/deadline: Do not truncate a bandwidth to 32 bits in __dl_add/sub() Mathieu Desnoyers
2026-11-30 12:56 ` Juri Lelli
2026-11-30 14:12 ` David Laight
2026-11-30 15:26 ` Mathieu Desnoyers
2026-11-30 18:16 ` David Laight
2026-12-01 15:11 ` Mathieu Desnoyers
2026-12-01 16:14 ` David Laight
2026-12-01 16:27 ` Mathieu Desnoyers
2026-12-01 17:20 ` David Laight
2026-11-27 14:35 ` [PATCH v12 21/43] rtmutex: Continue the chain walk when a waiter's deadline donor changes Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 22/43] rtmutex: Do not stop the chain walk at an owner whose top waiter changed Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 23/43] sched/deadline: Hold a reference on the deadline donor of a boosted task Mathieu Desnoyers
2026-11-30 14:25 ` Juri Lelli
2026-11-30 15:27 ` Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 24/43] selftests/sched: Test the rtmutex chain walk in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 25/43] sched/deadline: Count the 0-lag time from the next period Mathieu Desnoyers
2026-11-30 16:47 ` Juri Lelli
2026-12-01 15:12 ` Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 26/43] sched/deadline: Keep a departing constrained task until its " Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 27/43] sched/deadline: Replenish a throttled task boosted while asleep Mathieu Desnoyers
2026-11-30 14:48 ` Juri Lelli
2026-11-30 15:27 ` Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 28/43] sched/deadline: Restore the owner's period at a deboost in the class Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 29/43] sched/deadline: Count the bandwidth a boosted task is given Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 30/43] sched/deadline: Start a period for a task that enters the class blocked Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 31/43] sched/deadline: Restore the owner's period at a deboost out of the class Mathieu Desnoyers
2026-11-27 14:35 ` [PATCH v12 32/43] sched/deadline: Start a period for a task requeued onto an rt_mutex Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 33/43] selftests/sched: Test deadline boosts in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 34/43] sched/deadline: Cancel the replenishment timer with the parameters Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 35/43] sched/deadline: Cap the runtime left of a constrained task at dl_runtime Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 36/43] sched/deadline: Check the runtime of a task that comes back runnable Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 37/43] sched/deadline: Keep the debt of a task across a change of parameters Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 38/43] sched/deadline: Boost an owner that cannot run on its own reservation Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 39/43] sched/deadline: Boost an owner throttled after its waiter blocked Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 40/43] sched/deadline: Reschedule a running task throttled at its enqueue Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 41/43] sched/deadline: Run a boost held at its first refill on a donor period Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 42/43] selftests/sched: Test parameter changes in deadline_bw_test Mathieu Desnoyers
2026-11-27 14:36 ` [PATCH v12 43/43] selftests/sched: Share the helpers of the deadline tests Mathieu Desnoyers
2026-11-30 17:15 ` [PATCH v12 00/43] sched/deadline: bandwidth accounting fixes and selftests Juri Lelli
2026-12-01 15:06 ` Mathieu Desnoyers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f897938f-65a0-418a-b1dd-360291185102@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=bigeasy@linutronix.de \
--cc=boqun@kernel.org \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=clrkwllms@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=kayracizmeci@gmail.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=longman@redhat.com \
--cc=luca.abeni@santannapisa.it \
--cc=m.szyprowski@samsung.com \
--cc=mathieu.poirier@linaro.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=parri.andrea@gmail.com \
--cc=peterz@infradead.org \
--cc=ridong.chen@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=tj@kernel.org \
--cc=tommaso.cucinotta@gmail.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=weihengqiuu@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox