mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuri Andriaccio <yurand2000@gmail.com>
To: tj@kernel.org
Cc: bsegall@google.com, cgroups@vger.kernel.org,
	dietmar.eggemann@arm.com, hannes@cmpxchg.org,
	juri.lelli@redhat.com, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it,
	mgorman@suse.de, mingo@redhat.com, mkoutny@suse.com,
	peterz@infradead.org, 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: Wed, 11 Nov 2026 18:56:57 +0100	[thread overview]
Message-ID: <20261111175657.250354-1-yurand2000@gmail.com> (raw)
In-Reply-To: <212c244d534ee1fdb0538a980789e16c@kernel.org>

Hello Tejun,

Thanks for taking a look. I'm answering some of your comments first and at the
end I'm proposing a summary of changes that will appear in the next RFC to
then "stabilize" the user interface.



> The new name still doesn't follow the cgroup2 naming convention.

Thanks for pointing this out, it was a mistake on my end. This will be fixed
in the next RFC.

> The file prints a "CPU runtime=R period=P" line for each possible CPU.

We will condense the displaying for same runtime/period CPUs and omit zeroed
ones.



> Switching between "max" and a budget is refused while the cgroup or its
> "max" descendants have RT tasks. That's okay as a restriction for now.
> Ideally, the switch wouldn't be restricted as long as the budget is
> sufficient, but that can be left for the future.

The restriction is in place to simplify the initial implementation: switching
between "max" and non-"max" requires to migrate all tasks from one cgroup's
runqueues to another cgroup ones, and could potentially be an expensive
operation if there are lots of tasks. If you think the restriction is
acceptable (for now), we will keep this unchanged in hte next RFC, and fix it
later.



> Can we separate cpu.rt.max from cpuset?

Maybe we misunderstood, but in some previous discussion it was asked us to
integrate the `cpuset` and `cpu` controllers somehow. Your proposal of having
the `cpu` and `cpuset` controllers orthogonal simplifies things, but it is
similar to the previous (cgroup-v1-based) implementation, or before the
integration patch itself (i.e. just allow the per-CPU overrides but remove the
tighter coupling). What is the final verdict on this?



> On the per-CPU budgets themselves, they don't match cpu.max, and giving
> a budget per CPU is a bit odd when the consumption isn't per CPU. The
> threads move around. Maybe it can't be avoided, but I'd like to see a
> discussion of the rationale behind the design choice and some
> exploration of alternatives.

I'm not sure if I'm understanding correctly here, but the budget for
`cpu.rt.max`, differently from `cpu.max`, is meant to be per-CPU and not
global. Sure the initial patches have a single setting that is the same on all
CPUs, but it was meant to be a per-CPU limit that is the same across all cores.
Notice that threads move around, but we prevent migrating them to cores with
zero runtime (hence, there is some overlap of functionality between cpusets
and rt-cgroups).

The rationale behind this is that, from a real-time theoretical pov, it is
necessary to know how much budget and how it is distributed on the CPUs, as
changing the number of CPUs or the budget distribution radically changes the
schedulability outputs. The most complete and flexible interface is therefore
having per-CPU budgets.

This is also necessary to prevent over-provisioning and allowing partitioning
of the total bandwidth:

- If implementing solution 1, a request of 10% of budget reserves 10% of
  runtime on all cores, regardless of `cpuset` settings. Of course a `cpuset`
  mask that is smaller than the total allows limiting the tasks on a subset
  of CPUs, yet the budget on the unused cores is still allocated, and therefore
  wasted. This is a case of over-provisioning.
- On the other hand, allowing per-CPU controls allows to potentially partition
  the total bandwidth in the CPU hierarchy, for example reserving some 10%
  runtime on some cores, while still allowing other cgroups to make use of the
  unused 10% bandwidth on the other cores.

From this limited discussion it appears to us that solution 2, which is
similar to what we already had but without the "default" case, is the most
suitable. Solutions 1 and 3 are more or less what already exists before
the `cpuset` integration patches.



> AFAICS, disabling the cpuset controller above a budgeted cgroup moves it to
> the ancestor's cpuset and changes its effective CPUs without going through
> the lockout at all.

You are right, we tried to prevent changes in the `cpuset` when an active
rt-cgroup was involved but this was clearly missed out.

The lockout is in place because, in the current integration, it is necessary
to rerun the bandwdith admission test on every `cpuset` change, which greatly
complicates the code. Nonetheless, a more permissive integration still needs
to couple updates in both controllers and run some admission tests.



> Skipping the boost when the target has no runtime is fine as long
> as nothing stalls.

For PI and zero-budget cgroups, if this is an acceptable solution, it seems
the most straightforward one: disallow switching to RT for zeroed cgroups and
disable zeroing the budget of any parent which has active RT tasks.

- - -

As mentioned at the beginning, here is a summary of what the interface
would be after the discussed points:

- `cpu.rt.max` and `cpu.rt.max.effective.local` files. When displaying the
  per-CPU settings, zero runtimes are skipped and same runtime/period cpus
  are condensed in the same cpuset.

- `cpu.rt.max` only accepts per-CPU settings, so the global "default" is
  removed. Removing all overrides means the cgroup is a "max" cgroup, while
  just a single override means that the cgroup has its own budget.
  + This new interface disallows zero-runtime overrides, as a zero override
    is equal to an empty override when there is at least one non-zero override.
    As an example: [<CPU0 10ms 100ms>, <CPU1 0ms 100ms>] is equal to just
    having [<CPU0 10ms 100ms>]. This seems a bit odd, how to make this better?

- Switching between `max` and non-`max` is still disallowed for active
  real-time cgroups (to be left for the future).

- `cpu` and `cpuset` controllers are decoupled, as it was before the `cpuset`
  integration patch. The user/admin is responsible for inconsistencies between
  the two controllers (i.e. empty intersection between active server in the
  rt-cgroup and the allowed cpuset just disallows executing RT tasks entirely).

- zero "internal" runtime cgroups will disallow RT tasks and prevent
  priority boosting. Admission controls will disallow zeroing the "internal"
  budget of a parent which has active tasks running.

Hopefully we can agree on the ideas posted here. If you have any doubts or
better suggestions let us know.

Thanks,
Yuri

      reply	other threads:[~2026-11-11 17:57 UTC|newest]

Thread overview: 32+ 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 [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=20261111175657.250354-1-yurand2000@gmail.com \
    --to=yurand2000@gmail.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --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=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®