RT throttling, DL/ fair server, RT_GROUP_SCHED and everything
Subsystems (2)
Sebastian Andrzej Siewior
maintainerHi,
this is about the old RT throttling mechanism, the DL/fair server around the RT tasks, the /proc/sys/kernel/sched_rt_* mechanism to control the former and CONFIG_RT_GROUP_SCHED which never worked as it supposed to. The current status looks like a mess and I'm not sure if there is a bug somewhere leading to my headaches or if this is just not meant to be working together. If so out with it.
tl;dr /proc/…/sched_rt_*, sched_rt_runtime_exceeded() probably CONFIG_RT_GROUP_SCHED should be removed. A bit of docs should be added for the fair server (or the right place).
Now. Details.
The "old" RT throttler was meant to throttle RT task(s) that went rogue. The idea was to throttle the RT tasks so that the admin, using SCHED_OTHER, could step in and kill the misbehaving task. This, as simple as it sounds, is problematic on a PREEMPT_RT system because all the drivers are running also as SCHED_FIFO meaning throttling the RT class resulted also in not servicing any HW. So an admin can't interact with the system via SSH/ network or keyboard/ USB. What often did help was the fact that the RT application did realise its overstepping and contained themself.
As a result real-time applications under PREEMPT_RT disable the RT throttler because from time to time they do have legitimate cases where the RT class runs > 1s and the throttler just breaks everything. So hush.
Some people did not learn about the RT-throttler because at some point one CPU could run 100% real-time tasks if there were other CPUs available (the argument was that the SCHED_OTHER workload could be moved there).
The throttler used to be present unconditionally. Since commit 5f6bd380c7bdb ("sched/rt: Remove default bandwidth control") (v6.12) it is hidden behind CONFIG_RT_GROUP_SCHED. Without CONFIG_RT_GROUP_SCHED defined it does not exist, yet the proc files are there. Not sure if they do much.
With CONFIG_RT_GROUP_SCHED enabled assigning SCHED_FIFO-1 priority to a user task is kind of broken as it returns with -EPERM due to
| #ifdef CONFIG_RT_GROUP_SCHED
| /*
| * Do not allow real-time tasks into groups that have no runtime
| * assigned.
| */
| if (rt_group_sched_enabled() &&
| rt_bandwidth_enabled() && rt_policy(policy) &&
| task_group(p)->rt_bandwidth.rt_runtime == 0 &&
| !task_group_is_autogroup(task_group(p))) {
| retval = -EPERM;
| pr_err("%s(%d)\n", __func__, __LINE__);
| goto unlock;
| }
| #endif /* CONFIG_RT_GROUP_SCHED */rt_bandwidth.rt_runtime is zero and auto-group (which is SCHED_OTHER anyway) is off. I did not find a way to enable one of these knobs. The cgroup file (rt_runtime_us) that _should_ set rt_bandwidth.rt_runtime is CGroup v1 and not available (since we do v2 these days). I don't see how to bypass this. Unless rt_group_sched_enabled() is disabled I see no hope.
Oh wait, this was exactly mentioned in commit 277e0909754e9 ("sched:
Bypass bandwitdh checks with runtime disabled RT_GROUP_SCHED").
Once I passed these gates I got stuck at the next barrier. Since commit c2e390197ad13 ("sched/rt: Update default bandwidth for real-time tasks to ONE") (v7.2) the value for sysctl_sched_rt_runtime is at 1s, same as sysctl_sched_rt_period. (I am not going to mention that the documentation in Documentation/scheduler/sched-rt-group.rst is kind of outdated.)
This means the throttler does nothing since period can not exceed the runtime. I'm not sure why exactly but I can't lower the value because then tg_rt_schedulable() will complain in
| /* | * Nobody can have more than the global setting allows. | */ | if (total > to_ratio(global_rt_period(), global_rt_runtime())) | return -EINVAL;
so that one second remains. It can be disabled (via -1). One can revert the commit and have the throttler is working again (but more later). Once at 0.95s it can go up to 1s and down again but it can't go below its initial value. This does not look as it is working as designed.
Without enabled RT_GROUP_SCHED the files can be set. Are they useful? According to Documentation/scheduler/sched-deadline.rst it used for "admission control" whatever that means. Anyway the fair server still kicks if it is disabled. So I *think* this is just something else and not part for the docs there.
With RT_GROUP_SCHED enabled the two proc files can't change their content. Plus it all kind of works just for cgroup-v1 and for v2 it breaks RT applications. And it never worked AFAIK. So from my point of view CONFIG_RT_GROUP_SCHED did not serve any good and can go.
Moving on. The old throttler did warn one before throttling real-time tasks so the risk of a heart attack was limited but still there. The sched* trace events do not show this: the RT task goes away and the CPU might go idle in the end. But we did have the printk().
On the other hand the fair-server decides that it is time for a SCHED_OTHER task, the scheduler obeys and we switch to SCHED_OTHER and then back to SCHED_FIFO. Okay, more efficient (as no CPU in idle). No hint what goes on.
In order to get to the non-throttling behavior one needs to
echo 0 > /sys/kernel/debug/sched/fair_server/cpuX/runtime
There is a crumble of documentation in sched-rt-group.rst which went in via commit b1536481c81fb ("sched/rt: Update limit of sched_rt sysctl in documentation") but it has nothing to do with CONFIG_RT_GROUP_SCHED and the fair server is 100% fine working without it. I don't think it is the right place for this.
Side note: Remember me asking for a sched-event in sched_tick() if sched-lazy is promoted to an actual scheduling request? Well, this is what the fair-server preemption looks like with sched event enabled:
| loop-time-1295 [000] d.h1. 339.006215: sched_stat_runtime: comm=loop-time pid=1295 runtime=3999761 [ns] | loop-time-1295 [000] d.h1. 339.006482: sched_stat_runtime: comm=loop-time pid=1295 runtime=267302 [ns] | loop-time-1295 [000] d.h1. 339.008953: sched_stat_runtime: comm=loop-time pid=1295 runtime=2471124 [ns] | loop-time-1295 [000] dN.2. 339.008955: sched_stat_runtime: comm=loop-time pid=1295 runtime=1152 [ns] | loop-time-1295 [000] d..2. 339.008956: sched_switch: prev_comm=loop-time prev_pid=1295 prev_prio=9 prev_state=R ==> next_comm=kworker/u4:4 next_pid=1148 next_prio=120 | kworker/u4:4-1148 [000] d..21 339.008959: sched_waking: comm=sshd-session pid=1256 prio=120 target_cpu=000
suddenly Need-resched is set and we schedule to lower prio task. Not a problem if you know about this… Or have the timer events enabled at which point dl_task_timer will give you a hint. But we have LLMs so…
Anyway. Could this interface be moved to /sys/kernel/sched/fair_server away from the debugfs part? debugfs is not for stable kernels/ ABI. Is there a reason why this might be considered debugging and not final or restricted from productive?
Just to summarize:
- Remove /proc/sys/kernel/sched_rt_*
[ ] Yes [ ] No, because
_____________________
- Remove CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because
_____________________- An additional trace sched event for fair server preemption
[ ] Yes [ ] No, it is silly to have
- Fair server documentation needs to go to
[ ] It is fine where it is
[ ] To ____________________
Sebastian
Tejun Heo
maintainerHello, Sebastian.
Quoted 3 lines · Sebastian Andrzej Siewior
- Remove
CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because_____________________
RT_GROUP_SCHED in its current form isn't widely useful. No major distro kernel enables it (Fedora, RHEL/CentOS Stream, Debian, Ubuntu, openSUSE, Arch and the Android GKI defconfig, PREEMPT_RT flavors included). I have no objection to removing it.
There was an attempt to make it more useful: the Hierarchical Constant Bandwidth Server (HCBS) patchset from Yuri Andriaccio and Luca Abeni. It replaces RT_GROUP_SCHED with per-cgroup deadline servers and a cgroup2 interface. The last posting was RFC v6 in June:
https://lore.kernel.org/all/[email protected]/
The effort seems to have stalled.
Thanks.
--
tejun
Hi all,
Quoted 13 lines · On Fri, 23 Oct 2026 07:16:10 -1000 Tejun Heo <[email protected]> wrote:
Hello, Sebastian.
Quoted 3 lines · Sebastian Andrzej Siewior
- Remove
CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because_____________________
RT_GROUP_SCHEDin its current form isn't widely useful. No major distro kernel enables it (Fedora, RHEL/CentOS Stream, Debian, Ubuntu, openSUSE, Arch and the Android GKI defconfig,PREEMPT_RTflavors included). I have no objection to removing it.
Quoted 8 lines
There was an attempt to make it more useful: the Hierarchical Constant Bandwidth Server (HCBS) patchset from Yuri Andriaccio and Luca Abeni. It replaces
RT_GROUP_SCHEDwith per-cgroup deadline servers and a cgroup2 interface. The last posting was RFC v6 in June:https://lore.kernel.org/all/[email protected]/
The effort seems to have stalled.
Yuri is working on an updated version of the patchset... If everything goes well, a new RFC should arrive in few weeks :)
Luca
Sebastian Andrzej Siewior
maintainerQuoted 1 line · Tejun Heo
Hello, Sebastian.
Hi Tejun,
Quoted 9 lines · Sebastian Andrzej Siewior
Quoted 3 lines
- Remove
CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because_____________________
RT_GROUP_SCHEDin its current form isn't widely useful. No major distro kernel enables it (Fedora, RHEL/CentOS Stream, Debian, Ubuntu, openSUSE, Arch and the Android GKI defconfig,PREEMPT_RTflavors included). I have no objection to removing it.
Perfect.
Quoted 6 lines
There was an attempt to make it more useful: the Hierarchical Constant Bandwidth Server (HCBS) patchset from Yuri Andriaccio and Luca Abeni. It replaces
RT_GROUP_SCHEDwith per-cgroup deadline servers and a cgroup2 interface. The last posting was RFC v6 in June:
Yes, I am aware of this. It replaces RT_GROUP_SCHED and does not rely on it (as far as I remember).
Quoted 3 lines
The effort seems to have stalled.
Thanks.
Sebastian
Hi Sebastian,
Quoted 9 lines · Sebastian Andrzej Siewior
Hi,
this is about the old RT throttling mechanism, the DL/fair server around the RT tasks, the
/proc/sys/kernel/sched_rt_*mechanism to control the former andCONFIG_RT_GROUP_SCHEDwhich never worked as it supposed to. The current status looks like a mess and I'm not sure if there is a bug somewhere leading to my headaches or if this is just not meant to be working together. If so out with it.
Quoted 3 lines
tl;dr /proc/…/sched_rt_*,
sched_rt_runtime_exceeded()probablyCONFIG_RT_GROUP_SCHEDshould be removed. A bit of docs should be added for the fair server (or the right place).
Thanks for putting this recap together!
Quoted 1 line
Now. Details.
...
Quoted 5 lines
Without enabled
RT_GROUP_SCHEDthe files can be set. Are they useful? According toDocumentation/scheduler/sched-deadline.rstit used for "admission control" whatever that means. Anyway the fair server still kicks if it is disabled. So I *think* this is just something else and not part for the docs there.
Right, confusing, but for a root_domain comprising M CPUs, -deadline tasks can be created while the sum of their bandwidths stays below
M * (sched_rt_runtime_us / sched_rt_period_us)
and writing -1 disables the check altogether. That's the "admission control" the docs hand-wave about, and it's also why the knobs can't simply be deleted. As you noticed already, the servers are completely independent of these knobs:
writing -1 does not disable the fair server, it only lifts the DL admission cap. In principle we could move this to a different interface that reads closer to the underlying purpose, but I'm not sure how much breakage it could cause.
...
Quoted 4 lines
Anyway. Could this interface be moved to
/sys/kernel/sched/fair_serveraway from the debugfs part? debugfs is not for stable kernels/ ABI. Is there a reason why this might be considered debugging and not final or restricted from productive?
I think this was raised already in the past, but at the time maybe it was still to early to say if dl-servers will stick around. They now have got more users (sched-ext), so it might be a time we discuss a stable (non-debug) interface for it. Your suggestion doesn't look bad to me.
Quoted 4 lines
Just to summarize:
- Remove/proc/sys/kernel/sched_rt_*
[ ] Yes [ ] No, because_____________________
Yes and no :). We need an interface to tweak admission control, but we could find a better/different one.
Quoted 3 lines
- Remove
CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because_____________________
Luca already commented on this. I believe the plan is still to come up with a DEADLINE backed RT_GROUP_SCHED for Cgroups v2. If cleaner, an approach could be to first merge the removal of RT_GROUP_SCHED and then reimplement the whole lot as Yuri and Luca are proposing to do. The series is already somewhat doing that, but it could be made more explicit/clean I guess.
Quoted 2 lines
- An additional trace sched event for fair server preemption
[ ] Yes [ ] No, it is silly to have
With 820725b0eb59f ("sched: Add deadline tracepoints") we already have some of that: sched_dl_{throttle,replenish,update,server_start,server_stop}, which fire for fair/ext servers too (there's a type field, DL_SERVER_FAIR and friends). They of course require something like this [1] to be activated. We could add more if they are still not enough to get a clear picture about what's going on.
Quoted 3 lines
- Fair server documentation needs to go to
[ ] It is fine where it is
[ ] To ____________________
Not fine where it is: the servers (fair & ext) work independently of RT_GROUP_SCHED and deserve their own description (defaults 50ms/1s per CPU, what they guarantee for fair tasks under RT pressure, how to tune or disable them). Either a new section in sched-deadline.rst (they are DL servers after all) or a small standalone file works for me.
Thanks!
Juri
1 - https://github.com/jlelli/sched_tp/commits/deadline-tp/
from Qais' https://github.com/qais-yousef/sched_tp
Sebastian Andrzej Siewior
maintainerQuoted 1 line · Juri Lelli
Hi Sebastian,
Hi Juri,
Quoted 26 lines · Sebastian Andrzej Siewior
Quoted 9 lines
Hi,
this is about the old RT throttling mechanism, the DL/fair server around the RT tasks, the
/proc/sys/kernel/sched_rt_*mechanism to control the former andCONFIG_RT_GROUP_SCHEDwhich never worked as it supposed to. The current status looks like a mess and I'm not sure if there is a bug somewhere leading to my headaches or if this is just not meant to be working together. If so out with it.Quoted 3 lines
tl;dr /proc/…/sched_rt_*,
sched_rt_runtime_exceeded()probablyCONFIG_RT_GROUP_SCHEDshould be removed. A bit of docs should be added for the fair server (or the right place).Thanks for putting this recap together!
Quoted 1 line
Now. Details.
...
Quoted 5 lines
Without enabled
RT_GROUP_SCHEDthe files can be set. Are they useful? According toDocumentation/scheduler/sched-deadline.rstit used for "admission control" whatever that means. Anyway the fair server still kicks if it is disabled. So I *think* this is just something else and not part for the docs there.
Quoted 4 lines
Right, confusing, but for a
root_domaincomprising M CPUs, -deadline tasks can be created while the sum of their bandwidths stays belowM * (
sched_rt_runtime_us/sched_rt_period_us)
My understanding is that this is the runtime available to a DL task and the length of a DL period (after the accounted runtime is reset). The left over runtime (of runtime is less than period) is either buffer (idle) or SCHED_OTHER runtime.
This defines how much runtime a DL task gets from the system, correct?
Quoted 6 lines
and writing -1 disables the check altogether. That's the "admission control" the docs hand-wave about, and it's also why the knobs can't simply be deleted. As you noticed already, the servers are completely independent of these knobs:
writing -1 does not disable the fair server, it only lifts the DL admission cap. In principle we could move this to a different interface that reads closer to the underlying purpose, but I'm not sure how much breakage it could cause.
That is my point. The rt_ runtime/ period is about DL properties and not RT as in SCHED_FIFO/ RR as it once was. Both are set to one second as of today and can not be changed with enabled CONFIG_RT_GROUP_SCHED.
Could we please move it to /sys/kernel/sched/ and rename it as dl something? Is there any reason to keep as-is? There is
Documentation/scheduler/sched-deadline.rst Documentation/arch/arm64/asymmetric-32bit.rst
referring to it in DL context. There is "ftracetest" writing unconditionally -1 as a workaround, see commit 57c4cfd4a2eef ("ftrace/selftests: workaround cgroup RT scheduling issues").
If the runtime/ period arguments are fine then we could keep it and make them only apply for the DL period.
Two files have been repurposed and if your intention as to disable the RT throttler then you will be surprised.
Quoted 11 lines
...
Quoted 4 lines
Anyway. Could this interface be moved to
/sys/kernel/sched/fair_serveraway from the debugfs part? debugfs is not for stable kernels/ ABI. Is there a reason why this might be considered debugging and not final or restricted from productive?I think this was raised already in the past, but at the time maybe it was still to early to say if dl-servers will stick around. They now have got more users (sched-ext), so it might be a time we discuss a stable (non-debug) interface for it. Your suggestion doesn't look bad to me.
Thank you.
Quoted 7 lines
Quoted 4 lines
Just to summarize:
- Remove/proc/sys/kernel/sched_rt_*
[ ] Yes [ ] No, because_____________________Yes and no :). We need an interface to tweak admission control, but we could find a better/different one.
Okay.
Quoted 10 lines
Quoted 3 lines
- Remove
CONFIG_RT_GROUP_SCHED
[ ] Yes [ ] No, because_____________________Luca already commented on this. I believe the plan is still to come up with a DEADLINE backed
RT_GROUP_SCHEDfor Cgroups v2. If cleaner, an approach could be to first merge the removal ofRT_GROUP_SCHEDand then reimplement the whole lot as Yuri and Luca are proposing to do. The series is already somewhat doing that, but it could be made more explicit/clean I guess.
okay, then let me prepare a removal of this then.
Quoted 9 lines
Quoted 2 lines
- An additional trace sched event for fair server preemption
[ ] Yes [ ] No, it is silly to haveWith
820725b0eb59f("sched: Add deadline tracepoints") we already have some of that: sched_dl_{throttle,replenish,update,server_start,server_stop}, which fire for fair/ext servers too (there's a type field,DL_SERVER_FAIRand friends). They of course require something like this [1] to be activated. We could add more if they are still not enough to get a clear picture about what's going on.
Hmm. You may want to merge Qais's current master to get it compiled again ;) But then nothing hooks it up, so I just replaced with with trace_printk() just to see what happens and got:
| loop-time-1612 [000] d.h1. 154.121809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3999981 [ns] | loop-time-1612 [000] d.h1. 154.123812: sched_stat_runtime: comm=loop-time pid=1612 runtime=2003097 [ns] | loop-time-1612 [000] d.h1. 154.123812: replenish_dl_entity: trace_sched_dl_replenish_tp ^ | loop-time-1612 [000] dN.2. 154.123814: sched_stat_runtime: comm=loop-time pid=1612 runtime=1783 [ns] | loop-time-1612 [000] d..2. 154.123815: sched_switch: prev_comm=loop-time prev_pid=1612 prev_prio=9 prev_state=R ==> next_comm=ksoftirqd/0 next_pid=14 next_prio=120 | ksoftirqd/0-14 [000] d..2. 154.123817: sched_stat_runtime: comm=ksoftirqd/0 pid=14 runtime=3036 [ns] | ksoftirqd/0-14 [000] d..2. 154.123817: update_curr_dl_se: trace_sched_dl_update_tp | ksoftirqd/0-14 [000] d..2. 154.123818: dl_server_stop.part.0: trace_sched_dl_server_stop_tp | ksoftirqd/0-14 [000] d..2. 154.123819: sched_switch: prev_comm=ksoftirqd/0 prev_pid=14 prev_prio=120 prev_state=S ==> next_comm=loop-time next_pid=1612 next_prio=9 | loop-time-1612 [000] d.h1. 154.125809: sched_stat_runtime: comm=loop-time pid=1612 runtime=1992016 [ns] | loop-time-1612 [000] d.h1. 154.129809: sched_stat_runtime: comm=loop-time pid=1612 runtime=4000522 [ns] | loop-time-1612 [000] d.h1. 154.133809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3999631 [ns] | loop-time-1612 [000] d.h2. 154.133810: sched_waking: comm=ksoftirqd/0 pid=14 prio=120 target_cpu=000 | loop-time-1612 [000] d.h3. 154.133811: sched_stat_runtime: comm=loop-time pid=1612 runtime=1463 [ns] | loop-time-1612 [000] d.h3. 154.133811: dl_server_start: trace_sched_dl_server_start_tp | loop-time-1612 [000] dNh3. 154.133811: sched_wakeup: comm=ksoftirqd/0 pid=14 prio=120 target_cpu=000 | loop-time-1612 [000] d..2. 154.133812: sched_switch: prev_comm=loop-time prev_pid=1612 prev_prio=9 prev_state=R ==> next_comm=ksoftirqd/0 next_pid=14 next_prio=120 ^ | ksoftirqd/0-14 [000] d..2. 154.133812: sched_stat_runtime: comm=ksoftirqd/0 pid=14 runtime=2054 [ns] | ksoftirqd/0-14 [000] d..2. 154.133812: update_curr_dl_se: trace_sched_dl_update_tp | ksoftirqd/0-14 [000] d..2. 154.133813: dl_server_stop.part.0: trace_sched_dl_server_stop_tp | ksoftirqd/0-14 [000] d..2. 154.133814: sched_switch: prev_comm=ksoftirqd/0 prev_pid=14 prev_prio=120 prev_state=S ==> next_comm=loop-time next_pid=1612 next_prio=9 | loop-time-1612 [000] d.h1. 154.137809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3996495 [ns] | loop-time-1612 [000] d.h2. 154.137810: sched_waking: comm=ksoftirqd/0 pid=14 prio=120 target_cpu=000
Comparing the first and the second preemption point, it is different. The first looks like a direct consequence of the fair_server and second probably because of the left over budget. This reflects the implementation and I understand if you don't want to expose this directly as-is. There is also this where the N flag just vanishes:
| loop-time-1612 [000] d.h1. 159.029809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3997426 [ns] | loop-time-1612 [000] d.h2. 159.029811: sched_waking: comm=ksoftirqd/0 pid=14 prio=120 target_cpu=000 | loop-time-1612 [000] d.h3. 159.029811: sched_stat_runtime: comm=loop-time pid=1612 runtime=1543 [ns] | loop-time-1612 [000] d.h3. 159.029811: dl_server_start: trace_sched_dl_server_start_tp | loop-time-1612 [000] d.h3. 159.029811: enqueue_dl_entity: trace_sched_dl_replenish_tp | loop-time-1612 [000] dNh3. 159.029811: sched_wakeup: comm=ksoftirqd/0 pid=14 prio=120 target_cpu=000 | loop-time-1612 [000] d.h1. 159.033809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3998449 [ns] | loop-time-1612 [000] d.h1. 159.037809: sched_stat_runtime: comm=loop-time pid=1612 runtime=4000072 [ns] | loop-time-1612 [000] d.h1. 159.041809: sched_stat_runtime: comm=loop-time pid=1612 runtime=3999901 [ns]
I assume the bandwidth was replenished and then loop-time could remain on the CPU. It would probably help if I would weld have dump some DL details along…
I'm not sure if it would be better to add some DL details along or extend sched_switch with a scheduling reason.
There are also no trace events for DL tasks if they exceed their requested runtime, right? I *think* there is a signal (or can be) sent if the DL task runs for too long.
The sched_pelt* events didn't contain any bandwidth information as far as I can tell (you just pointed me there as an example how those trace points could be utilized I suppose).
Quoted 9 lines
Quoted 3 lines
- Fair server documentation needs to go to
[ ] It is fine where it is
[ ] To ____________________Not fine where it is: the servers (fair & ext) work independently of
RT_GROUP_SCHEDand deserve their own description (defaults 50ms/1s per CPU, what they guarantee for fair tasks under RT pressure, how to tune or disable them). Either a new section insched-deadline.rst(they are DL servers after all) or a small standalone file works for me.
Okay. Let me look into this.
Quoted 6 lines
Thanks!
Juri1 - https://github.com/jlelli/sched_tp/commits/deadline-tp/
from Qais' https://github.com/qais-yousef/sched_tp
Sebastian
Quoted 33 lines · Sebastian Andrzej Siewior
Quoted 1 line · Juri Lelli
Hi Sebastian,
Hi Juri,
Quoted 29 lines · Sebastian Andrzej Siewior
Quoted 9 lines
Hi,
this is about the old RT throttling mechanism, the DL/fair server around the RT tasks, the
/proc/sys/kernel/sched_rt_*mechanism to control the former andCONFIG_RT_GROUP_SCHEDwhich never worked as it supposed to. The current status looks like a mess and I'm not sure if there is a bug somewhere leading to my headaches or if this is just not meant to be working together. If so out with it.Quoted 3 lines
tl;dr /proc/…/sched_rt_*,
sched_rt_runtime_exceeded()probablyCONFIG_RT_GROUP_SCHEDshould be removed. A bit of docs should be added for the fair server (or the right place).Thanks for putting this recap together!
Quoted 1 line
Now. Details.
...
Quoted 5 lines
Without enabled
RT_GROUP_SCHEDthe files can be set. Are they useful? According toDocumentation/scheduler/sched-deadline.rstit used for "admission control" whatever that means. Anyway the fair server still kicks if it is disabled. So I *think* this is just something else and not part for the docs there.Right, confusing, but for a
root_domaincomprising M CPUs, -deadline tasks can be created while the sum of their bandwidths stays below
Quoted 7 lines
Quoted 1 line
M * (
sched_rt_runtime_us/sched_rt_period_us)My understanding is that this is the runtime available to a DL task and the length of a DL period (after the accounted runtime is reset). The left over runtime (of runtime is less than period) is either buffer (idle) or
SCHED_OTHERruntime.
This defines how much runtime a DL task gets from the system, correct?
How much bandwidth (runtime/period) DL tasks get from the system (comprised of M CPUs). And a corresponding cap (no more than that will be allowed to enter the system) - admission control.
Quoted 20 lines
Quoted 6 lines
and writing -1 disables the check altogether. That's the "admission control" the docs hand-wave about, and it's also why the knobs can't simply be deleted. As you noticed already, the servers are completely independent of these knobs:
writing -1 does not disable the fair server, it only lifts the DL admission cap. In principle we could move this to a different interface that reads closer to the underlying purpose, but I'm not sure how much breakage it could cause.That is my point. The
rt_runtime/ period is about DL properties and not RT as in SCHED_FIFO/ RR as it once was. Both are set to one second as of today and can not be changed with enabledCONFIG_RT_GROUP_SCHED.Could we please move it to
/sys/kernel/sched/and rename it as dl something? Is there any reason to keep as-is? There is
Documentation/scheduler/sched-deadline.rstDocumentation/arch/arm64/asymmetric-32bit.rstreferring to it in DL context. There is "ftracetest" writing unconditionally -1 as a workaround, see commit
57c4cfd4a2eef("ftrace/selftests: workaround cgroup RT scheduling issues").
Quoted 5 lines
If the runtime/ period arguments are fine then we could keep it and make them only apply for the DL period.
Two files have been repurposed and if your intention as to disable the RT throttler then you will be surprised.
Right, it's indeed confusing. I believe the intent for keeping as it is today was that in the future, if we get to 'fix' RT_GROUP_SCHED with HCBS, the existing knobs will be control both group and simple DL tasks bandwidth (they share the same bandwidth). I'm not against making things clearer. Maybe let's hear from others what they think as well?
...
Quoted 10 lines
Quoted 6 lines
With
820725b0eb59f("sched: Add deadline tracepoints") we already have some of that: sched_dl_{throttle,replenish,update,server_start,server_stop}, which fire for fair/ext servers too (there's a type field,DL_SERVER_FAIRand friends). They of course require something like this [1] to be activated. We could add more if they are still not enough to get a clear picture about what's going on.Hmm. You may want to merge Qais's current master to get it compiled again ;) But then nothing hooks it up, so I just replaced with with
trace_printk()just to see what happens and got:
Ack, yeah, I didn't use them recently and they rotted. :/
I will try to find some time soon to refresh and check what's missing from the information they provide (from a debugging point of view).
Thanks,
Juri