From: Juri Lelli <juri.lelli@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: luca abeni <luca.abeni@santannapisa.it>,
Tejun Heo <tj@kernel.org>, Yuri Andriaccio <yurand2000@gmail.com>,
bsegall@google.com, cgroups@vger.kernel.org,
dietmar.eggemann@arm.com, hannes@cmpxchg.org,
kprateek.nayak@amd.com, linux-kernel@vger.kernel.org,
mgorman@suse.de, mingo@redhat.com, mkoutny@suse.com,
rostedt@goodmis.org, vincent.guittot@linaro.org,
vschneid@redhat.com, yuri.andriaccio@santannapisa.it
Subject: Re: [RFC PATCH v7 00/29] Hierarchical Constant Bandwidth Server
Date: Fri, 27 Nov 2026 15:35:54 +0100 [thread overview]
Message-ID: <awmVSkc4T0AuFntw@jlelli-thinkpadt14gen4.remote.csb> (raw)
In-Reply-To: <20261127114828.GS49833@noisy.programming.kicks-ass.net>
Hello,
On 27/11/26 12:48, Peter Zijlstra wrote:
> On Mon, Nov 23, 2026 at 11:22:03AM +0100, Juri Lelli wrote:
> > IIUC reading your RTNS'21 paper with Stephen and Jim [1] right, those
> > are its conditions (1) and (2) for semi-partitioned systems, and
> > together they keep the system feasible. Did I get that right? The catch
> > is that the paper also needs changes to the migration logic (no throttle
> > bypass for tardy tasks, and the pushed task not counted in cpudl when
> > looking for a target) for tardiness to stay bounded, and AFAIK we don't
> > yet have that in mainline.
> >
> > So today's DL isn't "pinned aware", but we already live with that:
> > fair/ext servers are pinned and simply added to total_bw. I don't think
> > this series should fix that too. What I'd suggest instead is:
> >
> > 1. keep the interface per-CPU as Tejun proposed, and do admission as
> > above (sum into total_bw plus per-CPU check). When a config is
> > symmetric across the CPUs of a root domain, this is the same as
> > today's uniform reservation, so it works with the current DL
> > implementation with the same guarantees we have now;
> >
> > 2. accept asymmetric configs too, but document that, until DL becomes
> > aware of pinned bandwidth, they come with no tardiness guarantees
> > for DL tasks (as with non-default fair server settings today).
> > Once the migration side is fixed (the paper's changes, or
> > something similar), they get the guarantees without any interface
> > change.
> >
> > This also avoids the cost of the max approach, where 50% on one CPU
> > takes 50% of DL capacity on all CPUs of the root domain, and it should
> > be less code, since cgroup servers would just follow the dl_server
> > accounting paths (dl_server_apply_params(), dl_server_add_bw() on
> > root domain rebuilds), but Yuri should keep me honest here. :)
> >
> > The root entry would then just limit what cgroups can reserve per CPU,
> > on top of the above, which I think is what Tejun described.
> >
> > Thoughts?
>
> Still slowly working my way through all this email :/ So bear with me if
> I missed things already discussed elsewhere.
>
>
> So my suggestion to make all this cgroup-v2 only and couple with cpuset
> is exactly because of the bandwidth accounting. Specifically, cgroup-v2
> makes it possible to map a cgroup to a cpumask (exactly like we do in
> tg_cpus()). This in turn means we have a natural limit on the bandwidth
> consumption -- a cgroup's deadline servers will never run outside this
> mask and will thus never consume bandwidth outside of it.
>
> Without this, you get to account every cgroup to all CPUs, which is
> incredibly pessimistic; to the point of not actually being worth it.
With entries keyed by CPU (as Tejun proposed), I think we get the same
limit without coupling: a cgroup claims bandwidth only on the CPUs it
has an entry for, so nothing is accounted on CPUs it doesn't ask for.
Coupling seems to be needed only for the form that doesn't name CPUs
(your runtime/nr_cpus), where the CPUs come from the cpuset.
> As to bandwidth accounting; I once started adding per-cpu reservations.
> Sadly I never finished it and I seem to have misplaced those patches.
> But yes, that is something that wants to be done.
>
> I'm not sure I see how all this can function without having that TBH.
> All this runs on a giant pile of per-cpu servers; without strict per-cpu
> accounting much goes out the window.
>
> The basic idea isn't hard either, give each CPU 100%, subtract the
> per-cpu demands and hand out the rest to the global pool. When demand
> exceeds supply, reject. The only somewhat tricky bit was that adding a
> local claim means you first have to try and lower the global supply --
> if that fails the whole thing fails.
I think that's what I was trying to describe: servers accounted in
total_bw (lowering the global supply) plus a per-CPU check on what's
pinned on each CPU. Fair/ext servers would become local claims as well,
as they are pinned too and today they are only checked against the root
domain total.
> A cgroup setting bandwidth for CPUs it cannot reach -- fine; the value
> will not be used. If the cgroup is grown (through cpusets) to include
> such a CPU, it will enact such a value, and if bandwidth reservation
> so demands, block the cpuset mask extension.
IIUC this is close to what Tejun suggested for offline CPUs (the entry
stays configured and takes effect again when the CPU comes back). The
question I see is what happens when the cpuset changes under existing
entries (cpuset is often managed by someone else, and a sibling
partition or hotplug can move CPUs too). Either the entry's bandwidth
stays claimed while its CPU is unreachable, so cpuset changes never
fail but that bandwidth sits unused, or it's released and claimed again
when the CPU becomes reachable, which means growing a cpuset can fail
because of the cpu controller. Tejun, Peter, does either work for both
of you?
> As to the whole max thing; am I understanding things right if I say this
> means the cgroup itself will not have a constraint? I saw talk about one
> cgroup having mixed constaint and no constraint CPUs? That's crazy talk
> and makes absolutely no sense. Please don't support this.
>
> Either a cgroup has a constraint or it does not.
AFAIU, "max" means the cgroup has no servers of its own on that CPU, and
its tasks are served by the nearest ancestor that has an entry there
(or run as plain FIFO/RR if none has).
I tried to come up with (forge :) an example where mixing is useful in
[1]. The gist is delegation: a container P runs a single RT process,
with critical threads in P/crit (cpuset 4-10) and other FIFO threads in
P/noncrit (cpuset 0-3). The admin wants to cap what the container can
reserve, so the cap goes on P (P/crit's file is the container's to
write). The cap needs to cover CPUs 4-10 only: with entries on 0-3 as
well, P/noncrit would be served by P there, and its threads would either
not run at all (zero) or use a reservation they don't need. cpuset keeps
the two sets apart, so no task moves between a server and the root
runqueue. Luca's follow-up [2] is about doing it without mixing (budget
only on P/crit), which works if the admin configures the whole tree, but
not when P is delegated [3]. Admittedly, I'm still not sure why one
would want to run noncrit w/o a cap, as crit stuff might depend on
noncrit, so happy to be convinced this is actually useful for real. :)
1 - https://lore.kernel.org/all/awfe_r5McCTzr84x@jlelli-thinkpadt14gen4.remote.csb/
2 - https://lore.kernel.org/all/20261126155736.20e64e65@linux.fritz.box/
3 - https://lore.kernel.org/all/awhfdTbfDhpklaTN@jlelli-thinkpadt14gen4.remote.csb/
next prev parent reply other threads:[~2026-11-27 14:36 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 16:35 Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 01/29] sched/deadline: Introduce dl_freq_invariant flag for fair/ext servers Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 02/29] sched/deadline: Do not access dl_se->rq directly Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 03/29] sched/deadline: Distinguish between dl_rq and my_q Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 04/29] sched/rt: Pass an rt_rq instead of an rq where needed Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 05/29] sched/rt: Move functions from rt.c to sched.h Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 06/29] sched/rt: Disable RT_GROUP_SCHED Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 07/29] sched/rt: Remove unnecessary runqueue pointer in struct rt_rq Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 08/29] sched/rt: Introduce HCBS specific structs in task_group Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 09/29] sched/core: Initialize HCBS specific structures Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 10/29] sched/deadline: Add dl_init_tg Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 11/29] sched/rt: Add {alloc/unregister/free}_rt_sched_group Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 12/29] sched/deadline: Account rt-cgroups bandwidth in deadline tasks schedulability tests Yuri Andriaccio
2026-11-09 16:35 ` [RFC PATCH v7 13/29] sched/rt: Implement dl-server operations for rt-cgroups Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 14/29] sched/rt: Update task event callbacks for HCBS scheduling Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 15/29] sched/rt: Remove support for cgroups-v1 Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 16/29] sched/rt: Update rt-cgroup schedulability checks Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 17/29] sched/rt: Update task's RT runqueue when switching scheduling class Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 18/29] sched/rt: Remove old RT_GROUP_SCHED data structures Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 19/29] sched/rt: Add HCBS migration code to related functions Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 20/29] sched/rt: Hook HCBS migration functions Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 21/29] sched/core: Execute enqueued balance callbacks when changing allowed CPUs Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 22/29] sched/rt: Try pull task on empty server pick Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 23/29] sched/core: Execute enqueued balance callbacks after migrate_disable_switch Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 24/29] sched/syscalls: Allow unpriviledged tasks to set RT priority inside cgroups Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 25/29] sched/rt: Enable HRTICK_DL for HCBS servers Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 26/29] Documentation: Update documentation for real-time cgroups Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 27/29] sched/rt: Integrate cpuset and cpu controllers Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 28/29] sched/rt: Prevent CPU offline operation on active rt-cgroups Yuri Andriaccio
2026-11-09 16:36 ` [RFC PATCH v7 29/29] sched/rt: Introduce multi-cpu support Yuri Andriaccio
2026-11-10 21:43 ` [RFC PATCH v7 00/29] Hierarchical Constant Bandwidth Server Tejun Heo
2026-11-11 17:56 ` Yuri Andriaccio
2026-11-17 15:49 ` Juri Lelli
2026-11-18 8:07 ` Tejun Heo
2026-11-19 11:23 ` Juri Lelli
2026-11-19 14:27 ` luca abeni
2026-11-19 14:36 ` Juri Lelli
2026-11-19 14:42 ` luca abeni
2026-11-19 14:14 ` luca abeni
2026-11-20 6:46 ` Tejun Heo
2026-11-20 11:06 ` luca abeni
2026-11-20 11:55 ` Tejun Heo
2026-11-20 20:24 ` luca abeni
2026-11-21 17:24 ` Tejun Heo
2026-11-23 7:43 ` luca abeni
2026-11-23 10:22 ` Juri Lelli
2026-11-23 14:18 ` luca abeni
2026-11-26 7:25 ` Juri Lelli
2026-11-26 7:43 ` luca abeni
2026-11-26 7:49 ` Juri Lelli
2026-11-26 7:58 ` luca abeni
2026-11-26 8:02 ` Juri Lelli
2026-11-26 14:57 ` luca abeni
2026-11-26 16:33 ` Juri Lelli
2026-11-27 14:26 ` luca abeni
2026-11-27 11:48 ` Peter Zijlstra
2026-11-27 14:35 ` Juri Lelli [this message]
2026-11-27 15:09 ` luca abeni
2026-11-16 14:25 ` Juri Lelli
2026-11-17 13:00 ` Yuri Andriaccio
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=awmVSkc4T0AuFntw@jlelli-thinkpadt14gen4.remote.csb \
--to=juri.lelli@redhat.com \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yurand2000@gmail.com \
--cc=yuri.andriaccio@santannapisa.it \
/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
all inboxes | Powered by JetHome®