Re: [RFC PATCH v7 00/29] Hierarchical Constant Bandwidth Server

From: Juri Lelli

Date: Thu Nov 26 2026 - 02:26:03 EST


On 23/11/26 15:18, luca abeni wrote:
> On Mon, 23 Nov 2026 11:22:03 +0100
> Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:
>
> > Hello!
> >
> > Me again interjecting, please bear with me, but I think we want to get
> > this as right as we can. :)
> >
> > On 23/11/26 08:43, luca abeni wrote:
> > > Hi Tejun,
> > >
> > > On Sat, 21 Nov 2026 07:24:36 -1000
> > > Tejun Heo <tj@xxxxxxxxxx> wrote:
> > >
> > > > Hello, Luca.
> > > >
> > > > On Fri, Nov 20, 2026 at 09:24:18PM +0100, luca abeni wrote:
> > > > > But the deadline entities serving the real-time tasks in a
> > > > > cgroup are pinned to cores (one dl entity serves the cgroup's
> > > > > RT rq for a core). So, they cannot just be added to the sum
> > > > > mentioned above (which works for dl entities which are free to
> > > > > migrate). This issue was solved by reserving a fraction of the
> > > > > CPU time (and the root cgroup parameters indicated this
> > > > > fraction) to RT cgropus, so that the SCHED_DEADLINE admission
> > > > > control is still the same (we just decrease "limit" by the
> > > > > fraction reserved to RT cgroups).
> > > >
> > > > I see. Can the fraction be the maximum across the CPUs then? With
> > > > the root at "max", the kernel knows how much the cgroup servers
> > > > have reserved on each CPU. If "limit" is decreased by the largest
> > > > of those on all CPUs, every CPU has at least what its servers
> > > > need set aside and the admission control for tasks stays the same.
> > > >
> > > > I'm not familiar with the admission test, so I may be missing
> > > > something.
> > >
> > > Uhm... I think this can increase the code complexity, but yes, I
> > > guess it can work.
> >
> > What about a slightly different approach? Instead of reserving a
> > fraction up front (or the max across CPUs), cgroup servers could be
> > accounted like fair/ext servers already are: each server adds its
> > bandwidth to total_bw of its root domain, and on top of the global
> > test we check, per CPU, that pinned bandwidth (cgroup servers plus
> > fair/ext servers) stays within the limit.
>
> I am not sure about the SP theory, but if this solution is fine with
> kernel maintainers, I think this will work, too (it is even better, as
> it reduces work for Yuri :)

Just for my own (hopefully) better understanding, I tried to come up
with a setup that uses a cgroup with entries on some CPUs and "max" on
others, to reason about it more concretely. This is an illustration, not
a deployment I actually know of:

A container runs a single RT process. A few threads (control loops) need
a guaranteed budget. The other threads are FIFO as well (e.g. comms or
watchdog threads that must preempt normal tasks promptly but use little
CPU, or threads that simply inherited the policy), but need no
guarantee, and shouldn't run on the reserved budget, as they would eat
it while the loops sleep.

P/ cpuset.cpus=0-10
cpu.rt.max: 4-10 runtime=400 period=1000
P/noncrit cpuset.cpus=0-3 (threaded, no cpu.rt.max entries)
P/crit cpuset.cpus=4-10 (threaded, no cpu.rt.max entries)

Threads in P/crit are served by P's servers on CPUs 4-10. Threads in
P/noncrit find no entry up to the root on CPUs 0-3 and run as plain
FIFO, as they do today. cpuset keeps the two sets apart, so no task ever
moves between a server and the root runqueue, which I think addresses
Luca's concern about tasks changing reservation on migration, at least
for setups that care about the analysis.

The mixed config ends up on P because of _delegation_. P's cpu.rt.max
belongs to whoever delegated P, and it's what bounds how much the
container can reserve. The application only arranges its threads below
it. If a cgroup had to be "all or nothing", the admin would have to give
P either zero on CPUs 0-3 (no RT threads there at all, not very
flexible) or a budget there (reserving DL bandwidth for threads that
don't need it).

Tejun, is this the kind of usage you had in mind?

Everybody, is something like this anywhere near what you think people
might be asking for? Do you have any other examples in mind?