* [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation
@ 2026-11-23 13:41 Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 1/6] sched: Mark RT_GROUP_SCHED broken Sebastian Andrzej Siewior
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
People used to disable the RT throttling mechanism by writing -1 to
/proc/sys/kernel/sched_rt_runtime_us. Since v6.12 they can still do this
but they don't disable RT throttling anymore. Instead this throttling
mechanism has been taken over by the fair_server which can be configured
via debugfs.
This is not really documented but a hint appeared a few cycles later in
Documentation/scheduler/sched-rt-group.rst. This can be found once you
know what you are looking for because this document describes the RT
group scheduling (CONFIG_RT_GROUP_SCHED). The fair_server is used even
without it.
The then there is global DL resource control which also shares this
file proc file (which is stuck if CONFIG_RT_GROUP_SCHED is enabled).
This little series:
- Marks CONFIG_RT_GROUP_SCHED as broken because I was not allowed to
remove it.
- Untangles DL usage of sched_rt_runtime_us and moves it to
/sys/kernel/sched/dl_period_us
/sys/kernel/sched/dl_runtime_us
This keeps the _us semantic that we used to have /proc. It _could_ be
changed to ns instead.
The updates to the proc interface are mirrored to the /sys interface
and produce warning on the first write without CONFIG_RT_GROUP_SCHED
enabled.
- rcutorture is not touched anymore. Joel Fernandes is working on it.
The rcutorture can be fixed independently since the sysctl variables
are no longer removed.
- Adds sysfs interface under /sys/kernel/sched/cpuX to represent the
runqueues. The only knob for now is fair_server_{period|runtime}
representing the fair_server parameters. If all goes well, debugfs
could be removed. The ext server could be moved, too.
- I tried to correct/ update documentation while at it. I added the -doc
folks on Cc so they are aware. I can drop them in the next posting, I
expect that this gets routed via the sched/-tip.
v3…v4: https://patch.msgid.link/20261113-sched_dl-v3-0-a76ffa1cdeee@linutronix.de
- Drop the cpu_active() verification for DL admission control updates.
Mathieu is working on getting it to work so I preserve it and don't
touch it.
- Drop the RCU-torture changes. Joel is reworking it so it no longer
needs to disable the RT-throttling (or the fair_server now).
- The proc/ sysctl knobs are not removed. Update to the sysctl
interface are mirror to the sysfs admission control but not the
other way around. An update to the sysctl interface without
CONFIG_RT_GROUP_SCHED enabled will print a warning.
LTP was complaining about the removal. On the other hand it was just
complaining that writting -2 to runtime resulted in EBADF instead
EINVAL. So…
v2…v3: https://patch.msgid.link/20261110-sched_dl-v2-0-cc9399f7aeb1@linutronix.de
- Corrected in wording sched-rt-group.rst (Pointed out by Randy)
- RCU-torture now disables the fair_server from its boost-thread. The
code expects the CPU to be active which is after the CPU-hotplug
notifier is run. An alternative would be to not start the
fair_server (in the RCU-torture built-in case).
- sched_dl_try_boundary() has now a private mutex to perform the
update. sashiko complains that the values are read outside of
sched_domains_mutex and written back while it is held, making it
possible to write stale period/ runtime values back.
- proper u64 casting for NSEC_PER_USEC multiplication.
- sysfs_dl_runtime is not static and accessed in
dl_bandwidth_enabled(). This was missed earlier.
The remaining sysctl_sched_rt_{runtime|period} are now also hidden
behind CONFIG_RT_GROUP_SCHED.
v1…v2: https://lore.kernel.org/all/20261105164724.yxONBd03@linutronix.de/
- Tejun and PeterZ asked for marking CONFIG_RT_GROUP_SCHED broken
first.
- Everything after patch #1 that got queued up.
RFC…v1: https://lore.kernel.org/all/20261023161348.t3lpPLQZ@linutronix.de/
- Try to remove RT-GROUP-sched after figuring out that it is useless.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Sebastian Andrzej Siewior (6):
sched: Mark RT_GROUP_SCHED broken
sched: Move DL's admission control to sysfs
sched: Add sysfs files for the per-CPU fair_server knobs
sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED
Documentation/sched: Drop the section enumeration in sched-deadline
Documentation/sched: Add fairserver to sched-deadline
Documentation/arch/arm64/asymmetric-32bit.rst | 2 +-
Documentation/scheduler/sched-deadline.rst | 149 ++++++------
Documentation/scheduler/sched-rt-group.rst | 7 +-
init/Kconfig | 2 +-
kernel/sched/deadline.c | 312 +++++++++++++++++++++++++-
kernel/sched/debug.c | 56 +----
kernel/sched/features.h | 2 +
kernel/sched/rt.c | 27 +--
kernel/sched/sched.h | 65 +++---
9 files changed, 432 insertions(+), 190 deletions(-)
---
base-commit: a4d7daea71be591034445c17d4d81132a1785a12
change-id: 20261110-sched_dl-a9727787112f
Best regards,
--
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 1/6] sched: Mark RT_GROUP_SCHED broken
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 2/6] sched: Move DL's admission control to sysfs Sebastian Andrzej Siewior
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
The RT_GROUP_SCHED is broken beyond repair and it is best to not enable
it during compile. If enabled it is recommended to disable it at boot
time with the rt_group_sched= option.
With it enabled it is not possible to set the policy of a task to
SCHED_{FIFO|RR} because its cgroup has no runtime assigned. The runtime
can not be assigned with cgroup v2. The root group has however all the
runtime assigned meaning the global sysctl runtime parameter
(sched_rt_runtime_us) can no be reduced because the new bandwidth will
be less than what is current available.
It is possible to schedule SCHED_DEADLINE tasks but the admission
control is stuck can only be disabled via -1 (same sysctl parameter).
As a result all major distors (Debian, Open Suse, Fedora, Archlinux)
have it disabled.
There is work on Hierarchical constant bandwidth server (HCBS) which aim
to group multiple real-time tasks within one deadline configuration.
Mark CONFIG_RT_GROUP_SCHED broken. Move code which is not under
RT_GROUP_SCHED but only used by it within its IFDEF section. This
includes also RT_RUNTIME_SHARE.
Update the documentation, to state that it is not related to real-time
tasks in general but only to RT-group scheduling. While at it, also
update the current defaults.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/scheduler/sched-rt-group.rst | 7 ++++++-
init/Kconfig | 2 +-
kernel/sched/features.h | 2 ++
kernel/sched/rt.c | 6 ------
kernel/sched/sched.h | 19 +++++++++++--------
5 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/Documentation/scheduler/sched-rt-group.rst b/Documentation/scheduler/sched-rt-group.rst
index ab464335d3204..cd69c93baeb6a 100644
--- a/Documentation/scheduler/sched-rt-group.rst
+++ b/Documentation/scheduler/sched-rt-group.rst
@@ -18,6 +18,11 @@ Real-Time group scheduling
0. WARNING
==========
+ This document applies to RT group scheduling provided by CONFIG_RT_GROUP_SCHED.
+ If you don't use RT-group scheduling, schedule real-time tasks and experience
+ throttling issues please look into Documentation/scheduler/sched-deadline.rst
+ for the fair_server.
+
Fiddling with these settings can result in an unstable system, the knobs are
root only and assumes root knows what he is doing.
@@ -111,7 +116,7 @@ lack an EDF scheduler to make non-uniform periods usable.
---------------------
The default values for sched_rt_period_us (1000000 or 1s) and
-sched_rt_runtime_us (950000 or 0.95s). This gives 0.05s to be used by
+sched_rt_runtime_us (1000000 or 1s). This gives 0s to be used by
SCHED_OTHER (non-RT tasks). These defaults were chosen so that a run-away
real-time tasks will not lock up the machine but leave a little time to recover
it. By setting runtime to -1 you'd get the old behaviour back.
diff --git a/init/Kconfig b/init/Kconfig
index c8a7cfa60a6ea..4c00c02aa1c14 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -981,7 +981,7 @@ config CFS_BANDWIDTH
config RT_GROUP_SCHED
bool "Group scheduling for SCHED_RR/FIFO"
- depends on CGROUP_SCHED
+ depends on CGROUP_SCHED && BROKEN
default n
help
This feature lets you explicitly allocate real CPU bandwidth
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 8f0dee8fc4755..acc1c3fdfe2a2 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -122,7 +122,9 @@ SCHED_FEAT(RT_PUSH_IPI, false)
# endif
#endif
+#ifdef CONFIG_RT_GROUP_SCHED
SCHED_FEAT(RT_RUNTIME_SHARE, false)
+#endif
SCHED_FEAT(LB_MIN, false)
SCHED_FEAT(ATTACH_AGE_LOAD, true)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1535046a23ffa..cdeddd3fc9af2 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -944,12 +944,6 @@ static inline const struct cpumask *sched_rt_period_mask(void)
return cpu_online_mask;
}
-static inline
-struct rt_rq *sched_rt_period_rt_rq(struct rt_bandwidth *rt_b, int cpu)
-{
- return &cpu_rq(cpu)->rt;
-}
-
static void __enable_runtime(struct rq *rq) { }
static void __disable_runtime(struct rq *rq) { }
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index a4e6696e3a516..4d4128d5600f3 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -313,6 +313,7 @@ struct rt_prio_array {
struct list_head queue[MAX_RT_PRIO];
};
+#ifdef CONFIG_RT_GROUP_SCHED
struct rt_bandwidth {
/* nests inside the rq lock: */
raw_spinlock_t rt_runtime_lock;
@@ -321,6 +322,7 @@ struct rt_bandwidth {
struct hrtimer rt_period_timer;
unsigned int rt_period_active;
};
+#endif
static inline int dl_bandwidth_enabled(void)
{
@@ -581,6 +583,7 @@ extern void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b);
extern void unthrottle_cfs_rq(struct cfs_rq *cfs_rq);
extern bool cfs_task_bw_constrained(struct task_struct *p);
+#ifdef CONFIG_RT_GROUP_SCHED
extern void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
struct sched_rt_entity *rt_se, int cpu,
struct sched_rt_entity *parent);
@@ -589,6 +592,14 @@ extern int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us);
extern long sched_group_rt_runtime(struct task_group *tg);
extern long sched_group_rt_period(struct task_group *tg);
extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk);
+extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime);
+extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
+
+static inline int rt_bandwidth_enabled(void)
+{
+ return sysctl_sched_rt_runtime >= 0;
+}
+#endif
extern struct task_group *sched_create_group(struct task_group *parent);
extern void sched_online_group(struct task_group *tg,
@@ -877,11 +888,6 @@ struct scx_rq {
};
#endif /* CONFIG_SCHED_CLASS_EXT */
-static inline int rt_bandwidth_enabled(void)
-{
- return sysctl_sched_rt_runtime >= 0;
-}
-
/* RT IPI pull logic requires IRQ_WORK */
#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_SMP)
# define HAVE_RT_PUSH_IPI
@@ -3076,9 +3082,6 @@ extern void resched_curr(struct rq *rq);
extern void resched_curr_lazy(struct rq *rq);
extern void resched_cpu(int cpu);
-extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime);
-extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
-
extern void init_dl_entity(struct sched_dl_entity *dl_se);
extern void init_cfs_throttle_work(struct task_struct *p);
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/6] sched: Move DL's admission control to sysfs
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 1/6] sched: Mark RT_GROUP_SCHED broken Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 3/6] sched: Add sysfs files for the per-CPU fair_server knobs Sebastian Andrzej Siewior
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
SCHED_DL uses the sysctl sched_rt_{period|runtime}_us to configure its
admission control. It is used to verify that it does not allocate more
time globally to SCHED_DL tasks than it can theoretically handle.
This sysctl used to control RT throttling. With the introduction of the
DL server this knob controls RT throttling within a RT-cgroup if
CONFIG_RT_GROUP_SCHED is enabled. In this case the knob is also stuck
and can not be changed. So it can not be used for SCHED_DL control at
all. Unless to disable it by writing -1.
Split the DL bits into its knob at sysfs' location. Once the DL logic
is out, sched_domains_mutex.*() and rebuild_sched_domains() can be
removed from sched_rt_handler().
Move SCHED_DL usage of this sysctl to /sys/kernel/sched/ as
dl_runtime_us + dl_period_us. Replace global_rt_period()/
global_rt_runtime() with sysfs_dl_period/ sysfs_dl_runtime. Store the
new attributes in ns. Move global_rt_period()/ global_rt_runtime() to
CONFIG_RT_GROUP_SCHED.
Preserve compatibility for DL-admission update via the proc interface.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/arch/arm64/asymmetric-32bit.rst | 2 +-
Documentation/scheduler/sched-deadline.rst | 23 ++--
kernel/sched/deadline.c | 162 ++++++++++++++++++++++++--
kernel/sched/rt.c | 13 +--
kernel/sched/sched.h | 33 +++---
5 files changed, 179 insertions(+), 54 deletions(-)
diff --git a/Documentation/arch/arm64/asymmetric-32bit.rst b/Documentation/arch/arm64/asymmetric-32bit.rst
index fc0c350c5e001..375958f8971e5 100644
--- a/Documentation/arch/arm64/asymmetric-32bit.rst
+++ b/Documentation/arch/arm64/asymmetric-32bit.rst
@@ -105,7 +105,7 @@ affinity for the task is updated and any saved mask from a prior
Explicit admission of a 32-bit deadline task to the default root domain
(e.g. by calling ``sched_setattr(2)``) is rejected on an asymmetric
32-bit system unless admission control is disabled by writing -1 to
-``/proc/sys/kernel/sched_rt_runtime_us``.
+``/sys/kernel/sched/dl_runtime_us``.
``execve(2)`` of a 32-bit program from a 64-bit deadline task will
return ``-ENOEXEC`` if the root domain for the task contains any
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index 9019b66f6a5ba..4441bb689cca1 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -590,24 +590,19 @@ Deadline Task Scheduling
4.1 System wide settings
------------------------
- The system wide settings are configured under the /proc virtual file system.
+ The system wide settings are configured under /sys/kernel/sched.
- For now the -rt knobs are used for -deadline admission control and with
- CONFIG_RT_GROUP_SCHED the -deadline runtime is accounted against the (root)
- -rt runtime. With !CONFIG_RT_GROUP_SCHED the knob only serves for the -dl
- admission control. We realize that this isn't entirely desirable; however, it
- is better to have a small interface for now, and be able to change it easily
- later. The ideal situation (see 5.) is to run -rt tasks from a -deadline
- server; in which case the -rt bandwidth is a direct subset of dl_bw.
+ The ideal situation (see 5.) is to run -rt tasks from a -deadline server; in
+ which case the -rt bandwidth is a direct subset of dl_bw.
This means that, 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)
+ M * (dl_runtime_us / dl_period_us)
It is also possible to disable this bandwidth management logic, and
be thus free of oversubscribing the system up to any arbitrary level.
- This is done by writing -1 in /proc/sys/kernel/sched_rt_runtime_us.
+ This is done by writing -1 in /sys/kernel/sched/dl_runtime_us.
4.2 Task interface
@@ -648,11 +643,11 @@ Deadline Task Scheduling
4.3 Default behavior
---------------------
- The default value for SCHED_DEADLINE bandwidth is to have rt_runtime equal to
- 950000. With rt_period equal to 1000000, by default, it means that -deadline
- tasks can use at most 95%, multiplied by the number of CPUs that compose the
+ The default value for SCHED_DEADLINE bandwidth is to have dl_runtime_us equal to
+ 1000000. With rt_period equal to 1000000, by default, it means that -deadline
+ tasks can use at most 100%, multiplied by the number of CPUs that compose the
root_domain, for each root_domain.
- This means that non -deadline tasks will receive at least 5% of the CPU time,
+ This means that non -deadline tasks will receive at least 0% of the CPU time,
and that -deadline tasks will receive their runtime with a guaranteed
worst-case delay respect to the "deadline" parameter. If "deadline" = "period"
and the cpuset mechanism is used to implement partitioned scheduling (see
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index dfae08625342e..49ab477bb9bd1 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -23,6 +23,14 @@
#include "sched.h"
#include "pelt.h"
+/*
+ * Admission control for DL tasks. For a root_domain comprising M CPUs,
+ * -deadline tasks can be created while the sum of their bandwidths stays
+ * below: M * (dl_runtime / dl_period)
+ */
+static u64 sysfs_dl_period = 1000000 * NSEC_PER_USEC;
+u64 sysfs_dl_runtime = 1000000 * NSEC_PER_USEC;
+
/*
* Default limits for DL period; on the top end we guard against small util
* tasks still getting ridiculously long effective runtimes, on the bottom end we
@@ -509,10 +517,10 @@ static void init_dl_rq_bw_ratio(struct dl_rq *dl_rq);
void init_dl_bw(struct dl_bw *dl_b)
{
raw_spin_lock_init(&dl_b->lock);
- if (global_rt_runtime() == RUNTIME_INF)
+ if (sysfs_dl_runtime == RUNTIME_INF)
dl_b->bw = -1;
else
- dl_b->bw = to_ratio(global_rt_period(), global_rt_runtime());
+ dl_b->bw = to_ratio(sysfs_dl_period, sysfs_dl_runtime);
dl_b->total_bw = 0;
}
@@ -3687,10 +3695,8 @@ DEFINE_SCHED_CLASS(dl) = {
*/
u64 dl_cookie;
-int sched_dl_global_validate(void)
+static int sched_dl_global_validate(u64 runtime, u64 period)
{
- u64 runtime = global_rt_runtime();
- u64 period = global_rt_period();
u64 new_bw = to_ratio(period, runtime);
u64 cookie = ++dl_cookie;
struct dl_bw *dl_b;
@@ -3728,18 +3734,18 @@ int sched_dl_global_validate(void)
static void init_dl_rq_bw_ratio(struct dl_rq *dl_rq)
{
- if (global_rt_runtime() == RUNTIME_INF) {
+ if (sysfs_dl_runtime == RUNTIME_INF) {
dl_rq->bw_ratio = 1 << RATIO_SHIFT;
dl_rq->max_bw = dl_rq->extra_bw = 1 << BW_SHIFT;
} else {
- dl_rq->bw_ratio = to_ratio(global_rt_runtime(),
- global_rt_period()) >> (BW_SHIFT - RATIO_SHIFT);
+ dl_rq->bw_ratio = to_ratio(sysfs_dl_runtime,
+ sysfs_dl_period) >> (BW_SHIFT - RATIO_SHIFT);
dl_rq->max_bw = dl_rq->extra_bw =
- to_ratio(global_rt_period(), global_rt_runtime());
+ to_ratio(sysfs_dl_period, sysfs_dl_runtime);
}
}
-void sched_dl_do_global(void)
+static void sched_dl_do_global(void)
{
u64 new_bw = -1;
u64 cookie = ++dl_cookie;
@@ -3747,8 +3753,8 @@ void sched_dl_do_global(void)
int cpu;
unsigned long flags;
- if (global_rt_runtime() != RUNTIME_INF)
- new_bw = to_ratio(global_rt_period(), global_rt_runtime());
+ if (sysfs_dl_runtime != RUNTIME_INF)
+ new_bw = to_ratio(sysfs_dl_period, sysfs_dl_runtime);
for_each_possible_cpu(cpu)
init_dl_rq_bw_ratio(&cpu_rq(cpu)->dl);
@@ -4099,3 +4105,135 @@ void print_dl_stats(struct seq_file *m, int cpu)
{
print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
}
+
+#define SCHED_ATTR(_name) \
+ static struct kobj_attribute sched_attr_## _name = \
+ __ATTR(_name, 0644, sched_attr_##_name##_show, sched_attr_##_name##_store)
+
+int sched_dl_try_boundary(int runtime, int period)
+{
+ static DEFINE_MUTEX(sched_dl_update_lock);
+ u64 runtime_ns, period_ns;
+ int ret;
+
+ guard(mutex)(&sched_dl_update_lock);
+ if (runtime) {
+ if (runtime < 0)
+ runtime_ns = RUNTIME_INF;
+ else
+ runtime_ns = (u64)runtime * NSEC_PER_USEC;
+ } else {
+ runtime_ns = sysfs_dl_runtime;
+ }
+
+ if (period)
+ period_ns = (u64)period * NSEC_PER_USEC;
+ else
+ period_ns = sysfs_dl_period;
+
+ if (runtime_ns != RUNTIME_INF) {
+ if (runtime_ns > period_ns || runtime_ns > MAX_BW)
+ return -EINVAL;
+ }
+
+ sched_domains_mutex_lock();
+ ret = sched_dl_global_validate(runtime_ns, period_ns);
+ if (ret) {
+ sched_domains_mutex_unlock();
+ return ret;
+ }
+
+ sysfs_dl_period = period_ns;
+ sysfs_dl_runtime = runtime_ns;
+
+ sched_dl_do_global();
+ sched_domains_mutex_unlock();
+ /*
+ * After changing maximum available bandwidth for DEADLINE, we need to
+ * recompute per root domain and per cpus variables accordingly.
+ */
+ rebuild_sched_domains();
+ return 0;
+}
+
+static ssize_t sched_attr_dl_runtime_us_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ u64 val = sysfs_dl_runtime;
+
+ if (val == RUNTIME_INF)
+ val = -1;
+ else
+ do_div(val, NSEC_PER_USEC);
+
+ return sysfs_emit(buf, "%lld\n", val);
+}
+
+static ssize_t sched_attr_dl_runtime_us_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ int val, ret;
+
+ ret = kstrtoint(buf, 0, &val);
+ if (ret)
+ return ret;
+
+ if (!(val == -1 || val > 0))
+ return -EINVAL;
+
+ ret = sched_dl_try_boundary(val, 0);
+ if (ret)
+ return ret;
+ return count;
+}
+SCHED_ATTR(dl_runtime_us);
+
+static ssize_t sched_attr_dl_period_us_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ u64 val = sysfs_dl_period;
+
+ do_div(val, NSEC_PER_USEC);
+ return sysfs_emit(buf, "%lld\n", val);
+}
+
+static ssize_t sched_attr_dl_period_us_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ int val, ret;
+
+ ret = kstrtoint(buf, 0, &val);
+ if (ret)
+ return ret;
+ if (val <= 0)
+ return -EINVAL;
+
+ ret = sched_dl_try_boundary(0, val);
+ if (ret)
+ return ret;
+ return count;
+}
+SCHED_ATTR(dl_period_us);
+
+static struct attribute *sched_global_attrs[] = {
+ &sched_attr_dl_runtime_us.attr,
+ &sched_attr_dl_period_us.attr,
+ NULL,
+};
+
+static const struct attribute_group sched_global_attrs_group = {
+ .attrs = sched_global_attrs,
+};
+
+static int __init sched_dl_init(void)
+{
+ struct kobject *sched_kobj;
+
+ sched_kobj = kobject_create_and_add("sched", kernel_kobj);
+ if (!sched_kobj)
+ return -ENOMEM;
+ return sysfs_create_group(sched_kobj, &sched_global_attrs_group);
+}
+late_initcall(sched_dl_init);
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index cdeddd3fc9af2..bd37dbf2bebbe 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2871,7 +2871,6 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
int ret;
mutex_lock(&mutex);
- sched_domains_mutex_lock();
old_period = sysctl_sched_rt_period;
old_runtime = sysctl_sched_rt_runtime;
@@ -2882,26 +2881,18 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
if (ret)
goto undo;
- ret = sched_dl_global_validate();
+ ret = sched_dl_try_boundary(sysctl_sched_rt_runtime,
+ sysctl_sched_rt_period);
if (ret)
goto undo;
-
- sched_dl_do_global();
}
if (0) {
undo:
sysctl_sched_rt_period = old_period;
sysctl_sched_rt_runtime = old_runtime;
}
- sched_domains_mutex_unlock();
mutex_unlock(&mutex);
- /*
- * After changing maximum available bandwidth for DEADLINE, we need to
- * recompute per root domain and per cpus variables accordingly.
- */
- rebuild_sched_domains();
-
return ret;
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 4d4128d5600f3..e755572f1cbb1 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -109,6 +109,7 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);
extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
+extern u64 sysfs_dl_runtime;
extern int sysctl_sched_rt_period;
extern int sysctl_sched_rt_runtime;
extern int sched_rr_timeslice;
@@ -326,7 +327,7 @@ struct rt_bandwidth {
static inline int dl_bandwidth_enabled(void)
{
- return sysctl_sched_rt_runtime >= 0;
+ return sysfs_dl_runtime >= 0 && sysfs_dl_runtime != RUNTIME_INF;
}
/*
@@ -354,8 +355,6 @@ struct dl_bw {
};
extern void init_dl_bw(struct dl_bw *dl_b);
-extern int sched_dl_global_validate(void);
-extern void sched_dl_do_global(void);
extern int sched_dl_overflow(struct task_struct *p, int policy, const struct sched_attr *attr);
extern void __setparam_dl(struct task_struct *p, const struct sched_attr *attr);
extern void __getparam_dl(struct task_struct *p, struct sched_attr *attr, unsigned int flags);
@@ -364,6 +363,8 @@ extern bool dl_param_changed(struct task_struct *p, const struct sched_attr *att
extern int dl_cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial);
extern int dl_bw_deactivate(int cpu);
extern s64 dl_scaled_delta_exec(struct rq *rq, struct sched_dl_entity *dl_se, s64 delta_exec);
+extern int sched_dl_try_boundary(int runtime, int period);
+
/*
* SCHED_DEADLINE supports servers (nested scheduling) with the following
* interface:
@@ -599,6 +600,19 @@ static inline int rt_bandwidth_enabled(void)
{
return sysctl_sched_rt_runtime >= 0;
}
+
+static inline u64 global_rt_period(void)
+{
+ return (u64)sysctl_sched_rt_period * NSEC_PER_USEC;
+}
+
+static inline u64 global_rt_runtime(void)
+{
+ if (sysctl_sched_rt_runtime < 0)
+ return RUNTIME_INF;
+
+ return (u64)sysctl_sched_rt_runtime * NSEC_PER_USEC;
+}
#endif
extern struct task_group *sched_create_group(struct task_group *parent);
@@ -2532,19 +2546,6 @@ extern union sched_feat_key sched_feat_keys[__SCHED_FEAT_NR];
extern struct static_key_false sched_numa_balancing;
extern struct static_key_false sched_schedstats;
-static inline u64 global_rt_period(void)
-{
- return (u64)sysctl_sched_rt_period * NSEC_PER_USEC;
-}
-
-static inline u64 global_rt_runtime(void)
-{
- if (sysctl_sched_rt_runtime < 0)
- return RUNTIME_INF;
-
- return (u64)sysctl_sched_rt_runtime * NSEC_PER_USEC;
-}
-
/*
* Is p the current execution context?
*/
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 3/6] sched: Add sysfs files for the per-CPU fair_server knobs
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 1/6] sched: Mark RT_GROUP_SCHED broken Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 2/6] sched: Move DL's admission control to sysfs Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 4/6] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED Sebastian Andrzej Siewior
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
The fair_server exposes the runtime and period knobs per-CPU in the
debugfs folder. The debugfs interface is not a stable ABI.
Make the /sys/kernel/debug/sched/fair_server/cpu*/{period|runtime} knobs
available as /sys/kernel/sched/cpuX/{fair_server_period|fair_server_runtime}.
It adds a struct kobject to the rq and exposes only those two. The
per-runqueue folder is named `cpu' rather than `rq' since it might be
more intuitive to the user than `rq' or `runqueue'.
The set logic is pulled from the debugfs folder but it is still shared.
That debugfs logic could be removed (after providing the same for
ext-server) or symlinked for a while.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/sched/deadline.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++-
kernel/sched/debug.c | 56 ++----------------
kernel/sched/sched.h | 8 +++
3 files changed, 163 insertions(+), 53 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 49ab477bb9bd1..64e20e281b016 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -4106,6 +4106,59 @@ void print_dl_stats(struct seq_file *m, int cpu)
print_dl_rq(m, cpu, &cpu_rq(cpu)->dl);
}
+static unsigned long dl_server_period_max = (1UL << 22) * NSEC_PER_USEC; /* ~4 seconds */
+static unsigned long dl_server_period_min = (100) * NSEC_PER_USEC; /* 100 us */
+
+int __sched_server_write_common(enum dl_param param, u64 value, struct rq *rq,
+ struct sched_dl_entity *dl_se, const char *sname)
+{
+ u64 old_runtime, runtime, period;
+ int retval = 0;
+
+ scoped_guard (rq_lock_irqsave, rq) {
+ old_runtime = runtime = dl_se->dl_runtime;
+ period = dl_se->dl_period;
+
+ switch (param) {
+ case DL_RUNTIME:
+ if (runtime == value)
+ break;
+ runtime = value;
+ break;
+ case DL_PERIOD:
+ if (value == period)
+ break;
+ period = value;
+ break;
+ }
+
+ if (runtime > period ||
+ period > dl_server_period_max ||
+ period < dl_server_period_min) {
+ return -EINVAL;
+ }
+
+ if (!cpu_online(cpu_of(rq)))
+ return -EBUSY;
+
+ update_rq_clock(rq);
+ dl_server_stop(dl_se);
+ retval = dl_server_apply_params(dl_se, runtime, period, 0);
+ dl_server_start(dl_se);
+
+ if (retval < 0)
+ return retval;
+ }
+ if (!!old_runtime ^ !!runtime) {
+ pr_info("%s server %sabled on CPU %d%s.\n",
+ sname,
+ runtime ? "en" : "dis",
+ cpu_of(rq),
+ runtime ? "" : ", system may malfunction due to starvation");
+ }
+ return 0;
+}
+
#define SCHED_ATTR(_name) \
static struct kobj_attribute sched_attr_## _name = \
__ATTR(_name, 0644, sched_attr_##_name##_show, sched_attr_##_name##_store)
@@ -4227,13 +4280,110 @@ static const struct attribute_group sched_global_attrs_group = {
.attrs = sched_global_attrs,
};
+/* RQ */
+#define RQ_ATTR(_name) \
+ static struct kobj_attribute rq_## _name = \
+ __ATTR(_name, 0644, rq_##_name##_show, rq_##_name##_store)
+
+#define kobj_to_rq(__kobj) container_of(__kobj, struct rq, rq_kobj)
+
+static ssize_t rq_fair_server_runtime_show(struct kobject *kobj, struct kobj_attribute *attr,
+ char *buf)
+{
+ struct rq *rq = kobj_to_rq(kobj);
+ struct sched_dl_entity *dl_se;
+
+ dl_se = &rq->fair_server;
+
+ return sysfs_emit(buf, "%llu\n", dl_se->dl_runtime);
+}
+
+static ssize_t rq_fair_server_runtime_store(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct rq *rq = kobj_to_rq(kobj);
+ u64 val;
+ int ret;
+
+ ret = kstrtoull(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ ret = __sched_server_write_common(DL_RUNTIME, val, rq, &rq->fair_server, "Fair");
+ if (ret)
+ return ret;
+ return count;
+}
+RQ_ATTR(fair_server_runtime);
+
+static ssize_t rq_fair_server_period_show(struct kobject *kobj, struct kobj_attribute *attr,
+ char *buf)
+{
+ struct rq *rq = kobj_to_rq(kobj);
+ struct sched_dl_entity *dl_se;
+
+ dl_se = &rq->fair_server;
+
+ return sysfs_emit(buf, "%llu\n", dl_se->dl_period);
+}
+
+static ssize_t rq_fair_server_period_store(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct rq *rq = kobj_to_rq(kobj);
+ u64 val;
+ int ret;
+
+ ret = kstrtoull(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ ret = __sched_server_write_common(DL_PERIOD, val, rq, &rq->fair_server, "Fair");
+ if (ret)
+ return ret;
+ return count;
+}
+RQ_ATTR(fair_server_period);
+
+static struct attribute *rq_attrs[] = {
+ &rq_fair_server_runtime.attr,
+ &rq_fair_server_period.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(rq);
+
+static const struct kobj_type rq_ktype = {
+ .sysfs_ops = &kobj_sysfs_ops,
+ .default_groups = rq_groups,
+};
+
+static int sched_create_rq_sysfs(struct kobject *sched_kobj)
+{
+ unsigned int cpu;
+ int ret;
+
+ for_each_possible_cpu(cpu) {
+ struct rq *rq = cpu_rq(cpu);
+
+ ret = kobject_init_and_add(&rq->rq_kobj, &rq_ktype, sched_kobj,
+ "cpu%d", cpu);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
static int __init sched_dl_init(void)
{
struct kobject *sched_kobj;
+ int ret;
sched_kobj = kobject_create_and_add("sched", kernel_kobj);
if (!sched_kobj)
return -ENOMEM;
- return sysfs_create_group(sched_kobj, &sched_global_attrs_group);
+ ret = sysfs_create_group(sched_kobj, &sched_global_attrs_group);
+ if (ret)
+ return ret;
+ return sched_create_rq_sysfs(sched_kobj);
}
late_initcall(sched_dl_init);
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index dcf9b1daf3d06..e533cd0e085ca 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -363,23 +363,13 @@ static const struct file_operations sched_debug_fops = {
.release = seq_release,
};
-enum dl_param {
- DL_RUNTIME = 0,
- DL_PERIOD,
-};
-
-static unsigned long dl_server_period_max = (1UL << 22) * NSEC_PER_USEC; /* ~4 seconds */
-static unsigned long dl_server_period_min = (100) * NSEC_PER_USEC; /* 100 us */
-
static ssize_t sched_server_write_common(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos, enum dl_param param,
void *server)
{
long cpu = (long) ((struct seq_file *) filp->private_data)->private;
struct sched_dl_entity *dl_se = (struct sched_dl_entity *)server;
- u64 old_runtime, runtime, period;
struct rq *rq = cpu_rq(cpu);
- int retval = 0;
size_t err;
u64 value;
@@ -387,48 +377,10 @@ static ssize_t sched_server_write_common(struct file *filp, const char __user *u
if (err)
return err;
- scoped_guard (rq_lock_irqsave, rq) {
- old_runtime = runtime = dl_se->dl_runtime;
- period = dl_se->dl_period;
-
- switch (param) {
- case DL_RUNTIME:
- if (runtime == value)
- break;
- runtime = value;
- break;
- case DL_PERIOD:
- if (value == period)
- break;
- period = value;
- break;
- }
-
- if (runtime > period ||
- period > dl_server_period_max ||
- period < dl_server_period_min) {
- return -EINVAL;
- }
-
- if (!cpu_online(cpu_of(rq)))
- return -EBUSY;
-
- update_rq_clock(rq);
- dl_server_stop(dl_se);
- retval = dl_server_apply_params(dl_se, runtime, period, 0);
- dl_server_start(dl_se);
-
- if (retval < 0)
- return retval;
- }
-
- if (!!old_runtime ^ !!runtime) {
- pr_info("%s server %sabled on CPU %d%s.\n",
- server == &rq->fair_server ? "Fair" : "Ext",
- runtime ? "en" : "dis",
- cpu_of(rq),
- runtime ? "" : ", system may malfunction due to starvation");
- }
+ err = __sched_server_write_common(param, value, rq, dl_se,
+ server == &rq->fair_server ? "Fair" : "Ext");
+ if (err)
+ return err;
*ppos += cnt;
return cnt;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index e755572f1cbb1..eb215e3ac1260 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1443,6 +1443,7 @@ struct rq {
#endif
atomic_t nr_iowait;
+ struct kobject rq_kobj;
} __no_randomize_layout;
#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -3537,6 +3538,13 @@ extern void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
extern void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq);
extern void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq);
+enum dl_param {
+ DL_RUNTIME = 0,
+ DL_PERIOD,
+};
+extern int __sched_server_write_common(enum dl_param param, u64 value, struct rq *rq,
+ struct sched_dl_entity *dl_se, const char *sname);
+
extern void resched_latency_warn(int cpu, u64 latency);
#ifdef CONFIG_NUMA_BALANCING
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 4/6] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
` (2 preceding siblings ...)
2026-11-23 13:41 ` [PATCH v4 3/6] sched: Add sysfs files for the per-CPU fair_server knobs Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 6/6] Documentation/sched: Add fairserver to sched-deadline Sebastian Andrzej Siewior
5 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
The admission control for SCHED_DL has been moved to sysfs and RT
throttling has been moved (long ago) to the fair_server and its debugfs
interface.
This file remains to have an impact only on RT_GROUP_SCHED. Keeping it
for ABI/ compatibility reasons makes no sense because its original
purpose (RT throttling) is no longer served. Anyone changing this file
and hoping to change the throttling behaviour will be surprised.
Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED so everyone
using this outdated file is aware.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/sched/rt.c | 8 ++++++++
kernel/sched/sched.h | 5 +++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index bd37dbf2bebbe..258b187459bb9 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2877,6 +2877,14 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
if (!ret && write) {
+ if (!IS_ENABLED(CONFIG_RT_GROUP_SCHED)) {
+ const char *msg =
+ "Please note that DL admission control (via sched_rt_period_us, sched_rt_runtime_us) moved to sysfs.\n"
+ "This update will be mirrored. Controls for RT throttling moved to the fair_server.\n"
+ "This will not be mirrored. The fair_server settings are under /sys/kernel/sched/cpuX/.\n";
+
+ pr_warn_once("%s", msg);
+ }
ret = sched_rt_global_validate();
if (ret)
goto undo;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index eb215e3ac1260..922708b6aad65 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -110,8 +110,6 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);
extern void call_trace_sched_update_nr_running(struct rq *rq, int count);
extern u64 sysfs_dl_runtime;
-extern int sysctl_sched_rt_period;
-extern int sysctl_sched_rt_runtime;
extern int sched_rr_timeslice;
/*
@@ -585,6 +583,9 @@ extern void unthrottle_cfs_rq(struct cfs_rq *cfs_rq);
extern bool cfs_task_bw_constrained(struct task_struct *p);
#ifdef CONFIG_RT_GROUP_SCHED
+extern int sysctl_sched_rt_period;
+extern int sysctl_sched_rt_runtime;
+
extern void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
struct sched_rt_entity *rt_se, int cpu,
struct sched_rt_entity *parent);
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
` (3 preceding siblings ...)
2026-11-23 13:41 ` [PATCH v4 4/6] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
2026-11-23 14:17 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 6/6] Documentation/sched: Add fairserver to sched-deadline Sebastian Andrzej Siewior
5 siblings, 1 reply; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
Each headline within the document has a manual numbering. If a new
section is added in the middle of the document then one has to renumber
the sections that follow plus update the maunal TOC at the top of the
document.
Remove the manual created TOC and the numbers before the section. The
rendered HTML has a TOC.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/scheduler/sched-deadline.rst | 106 +++++++++++------------------
1 file changed, 40 insertions(+), 66 deletions(-)
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index 4441bb689cca1..b76bb61cd48fd 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -2,41 +2,16 @@
Deadline Task Scheduling
========================
-.. CONTENTS
-
- 0. WARNING
- 1. Overview
- 2. Scheduling algorithm
- 2.1 Main algorithm
- 2.2 Bandwidth reclaiming
- 3. Scheduling Real-Time Tasks
- 3.1 Definitions
- 3.2 Schedulability Analysis for Uniprocessor Systems
- 3.3 Schedulability Analysis for Multiprocessor Systems
- 3.4 Relationship with SCHED_DEADLINE Parameters
- 4. Bandwidth management
- 4.1 System-wide settings
- 4.2 Task interface
- 4.3 Default behavior
- 4.4 Behavior of sched_yield()
- 5. Tasks CPU affinity
- 5.1 Using cgroup v1 cpuset controller
- 5.2 Using cgroup v2 cpuset controller
- 6. Future plans
- A. Test suite
- B. Minimal main()
-
-
-0. WARNING
-==========
+WARNING
+=======
Fiddling with these settings can result in an unpredictable or even unstable
system behavior. As for -rt (group) scheduling, it is assumed that root users
know what they're doing.
-1. Overview
-===========
+Overview
+========
The SCHED_DEADLINE policy contained inside the sched_dl scheduling class is
basically an implementation of the Earliest Deadline First (EDF) scheduling
@@ -44,11 +19,11 @@ Deadline Task Scheduling
that makes it possible to isolate the behavior of tasks between each other.
-2. Scheduling algorithm
-=======================
+Scheduling algorithm
+====================
-2.1 Main algorithm
-------------------
+Main algorithm
+--------------
SCHED_DEADLINE [18] uses three parameters, named "runtime", "period", and
"deadline", to schedule tasks. A SCHED_DEADLINE task should receive
@@ -123,8 +98,8 @@ Deadline Task Scheduling
signals.
-2.2 Bandwidth reclaiming
-------------------------
+Bandwidth reclaiming
+--------------------
Bandwidth reclaiming for deadline tasks is based on the GRUB (Greedy
Reclamation of Unused Bandwidth) algorithm [15, 16, 17] and it is enabled
@@ -287,8 +262,8 @@ Deadline Task Scheduling
running_bw is incremented.
-2.3 Energy-aware scheduling
----------------------------
+Energy-aware scheduling
+-----------------------
When cpufreq's schedutil governor is selected, SCHED_DEADLINE implements the
GRUB-PA [19] algorithm, reducing the CPU operating frequency to the minimum
@@ -300,8 +275,8 @@ Deadline Task Scheduling
setting a fixed CPU frequency results in a lower amount of deadline misses.
-3. Scheduling Real-Time Tasks
-=============================
+Scheduling Real-Time Tasks
+==========================
@@ -323,8 +298,8 @@ Deadline Task Scheduling
suited for periodic or sporadic real-time tasks that need guarantees on their
timing behavior, e.g., multimedia, streaming, control applications, etc.
-3.1 Definitions
-------------------------
+Definitions
+-----------
A typical real-time task is composed of a repetition of computation phases
(task instances, or jobs) which are activated on a periodic or sporadic
@@ -369,8 +344,8 @@ Deadline Task Scheduling
is the minimum WCET, and U_max = max{WCET_i/P_i} is the maximum
utilization[12].
-3.2 Schedulability Analysis for Uniprocessor Systems
-----------------------------------------------------
+Schedulability Analysis for Uniprocessor Systems
+------------------------------------------------
If M=1 (uniprocessor system), or in case of partitioned scheduling (each
real-time task is statically assigned to one and only one CPU), it is
@@ -414,8 +389,8 @@ Deadline Task Scheduling
time-consuming to be performed on-line. Hence, as explained in Section
4 Linux uses an admission test based on the tasks' utilizations.
-3.3 Schedulability Analysis for Multiprocessor Systems
-------------------------------------------------------
+Schedulability Analysis for Multiprocessor Systems
+--------------------------------------------------
On multiprocessor systems with global EDF scheduling (non partitioned
systems), a sufficient test for schedulability can not be based on the
@@ -464,8 +439,8 @@ Deadline Task Scheduling
the total utilization is smaller or equal than M then the response times of
the tasks are limited.
-3.4 Relationship with SCHED_DEADLINE Parameters
------------------------------------------------
+Relationship with SCHED_DEADLINE Parameters
+-------------------------------------------
Finally, it is important to understand the relationship between the
SCHED_DEADLINE scheduling parameters described in Section 2 (runtime,
@@ -549,8 +524,8 @@ Deadline Task Scheduling
2018), Pau, France, April 2018.
-4. Bandwidth management
-=======================
+Bandwidth management
+====================
As previously mentioned, in order for -deadline scheduling to be
effective and useful (that is, to be able to provide "runtime" time units
@@ -587,8 +562,8 @@ Deadline Task Scheduling
interface we can put a cap on total utilization of -deadline tasks (i.e.,
\Sum (runtime_i / period_i) < global_dl_utilization_cap).
-4.1 System wide settings
-------------------------
+System wide settings
+--------------------
The system wide settings are configured under /sys/kernel/sched.
@@ -604,9 +579,8 @@ Deadline Task Scheduling
be thus free of oversubscribing the system up to any arbitrary level.
This is done by writing -1 in /sys/kernel/sched/dl_runtime_us.
-
-4.2 Task interface
-------------------
+Task interface
+--------------
Specifying a periodic/sporadic task that executes for a given amount of
runtime at each instance, and that is scheduled according to the urgency of
@@ -640,8 +614,8 @@ Deadline Task Scheduling
reference, that is not directly usable from user-space.
-4.3 Default behavior
----------------------
+Default behavior
+----------------
The default value for SCHED_DEADLINE bandwidth is to have dl_runtime_us equal to
1000000. With rt_period equal to 1000000, by default, it means that -deadline
@@ -659,8 +633,8 @@ Deadline Task Scheduling
-deadline task cannot fork.
-4.4 Behavior of sched_yield()
------------------------------
+Behavior of sched_yield()
+-------------------------
When a SCHED_DEADLINE task calls sched_yield(), it gives up its
remaining runtime and is immediately throttled, until the next
@@ -675,8 +649,8 @@ Deadline Task Scheduling
SCHED_DEADLINE tasks.
-5. Tasks CPU affinity
-=====================
+Tasks CPU affinity
+==================
Deadline tasks cannot have a cpu affinity mask smaller than the root domain they
are created on. So, using ``sched_setaffinity(2)`` won't work. Instead, the
@@ -685,8 +659,8 @@ Deadline Task Scheduling
See :ref:`Documentation/admin-guide/cgroup-v1/cpusets.rst <cpusets>` and
:ref:`Documentation/admin-guide/cgroup-v2.rst <cgroup-v2>` for more information.
-5.1 Using cgroup v1 cpuset controller
--------------------------------------
+Using cgroup v1 cpuset controller
+---------------------------------
An example of a simple configuration (pin a -deadline task to CPU0) follows::
@@ -703,8 +677,8 @@ Deadline Task Scheduling
echo $$ > cpu0/tasks
chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
-5.2 Using cgroup v2 cpuset controller
--------------------------------------
+Using cgroup v2 cpuset controller
+---------------------------------
Assuming the cgroup v2 root is mounted at ``/sys/fs/cgroup``, an example of a
simple configuration (pin a -deadline task to CPU0) follows::
@@ -717,8 +691,8 @@ Deadline Task Scheduling
echo $$ > deadline_group/cgroup.procs
chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
-6. Future plans
-===============
+Future plans
+============
Still missing:
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 6/6] Documentation/sched: Add fairserver to sched-deadline
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
` (4 preceding siblings ...)
2026-11-23 13:41 ` [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline Sebastian Andrzej Siewior
@ 2026-11-23 13:41 ` Sebastian Andrzej Siewior
5 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 13:41 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Sebastian Andrzej Siewior, Jonathan Corbet, Shuah Khan,
Randy Dunlap, Ingo Molnar, Peter Zijlstra, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, K Prateek Nayak, luca abeni,
Yuri Andriaccio, Yuri Andriaccio, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Uladzislau Rezki, Mathieu Desnoyers,
Lai Jiangshan, Zqiang, Davidlohr Bueso, Tejun Heo,
Johannes Weiner, Michal Koutný, Qais Yousef, John Ogness
The fair_server ensures the fair-class gets CPU run-time and throttles
even the rt-class if needed. Add this bit of wisdom and the recently
added sysfs knobs for configutiation.
Assisted-by: LLM
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/scheduler/sched-deadline.rst | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/Documentation/scheduler/sched-deadline.rst b/Documentation/scheduler/sched-deadline.rst
index b76bb61cd48fd..b2c1ae8b7dddf 100644
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -552,7 +552,8 @@ Bandwidth management
level.
A main difference between deadline bandwidth management and RT-throttling
- is that -deadline tasks have bandwidth on their own (while -rt ones don't!),
+ is that -deadline tasks have bandwidth on their own (while -rt have only
+ throttling via the fair_server),
and thus we don't need a higher level throttling mechanism to enforce the
desired bandwidth. In other words, this means that interface parameters are
only used at admission control time (i.e., when the user calls
@@ -579,6 +580,25 @@ System wide settings
be thus free of oversubscribing the system up to any arbitrary level.
This is done by writing -1 in /sys/kernel/sched/dl_runtime_us.
+Fair server settings
+--------------------
+
+ The fair server ensures that fair-class tasks (SCHED_OTHER) are not starved
+ and can be scheduled even when tasks in the RT scheduling class
+ (SCHED_FIFO and SCHED_RR) are consuming all CPU time. It replaces the
+ legacy RT throttling mechanism, which was configured through the procfs
+ interface.
+
+ The fair server executes fair-class tasks through a deadline-scheduling
+ server with a runtime budget. It guarantees that the runtime configured by
+ fair_server_runtime is provided within the interval defined by
+ fair_server_period.
+
+ Both values are specified in nanoseconds and can be configured on a
+ per-CPU basis through /sys/kernel/sched/cpuX. Setting
+ fair_server_runtime to 0 disables the fair server on the corresponding
+ CPU.
+
Task interface
--------------
--
2.55.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline
2026-11-23 13:41 ` [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline Sebastian Andrzej Siewior
@ 2026-11-23 14:17 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-11-23 14:17 UTC (permalink / raw)
To: linux-kernel, cgroups, rcu, linux-doc
Cc: Jonathan Corbet, Shuah Khan, Randy Dunlap, Ingo Molnar,
Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
K Prateek Nayak, luca abeni, Yuri Andriaccio, Yuri Andriaccio,
Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
Joel Fernandes, Josh Triplett, Boqun Feng, Uladzislau Rezki,
Mathieu Desnoyers, Lai Jiangshan, Zqiang, Davidlohr Bueso,
Tejun Heo, Johannes Weiner, Michal Koutný, Qais Yousef,
John Ogness
On 2026-11-23 14:41:11 [+0100], To linux-kernel@vger.kernel.org wrote:
> Each headline within the document has a manual numbering. If a new
> section is added in the middle of the document then one has to renumber
> the sections that follow plus update the maunal TOC at the top of the
> document.
>
> Remove the manual created TOC and the numbers before the section. The
> rendered HTML has a TOC.
sashiko complained that the that the references within the document
(such ass "see 5.") are now broken.
This should deal with it:
--- a/Documentation/scheduler/sched-deadline.rst
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -2,53 +2,29 @@
Deadline Task Scheduling
========================
-.. CONTENTS
-
- 0. WARNING
- 1. Overview
- 2. Scheduling algorithm
- 2.1 Main algorithm
- 2.2 Bandwidth reclaiming
- 3. Scheduling Real-Time Tasks
- 3.1 Definitions
- 3.2 Schedulability Analysis for Uniprocessor Systems
- 3.3 Schedulability Analysis for Multiprocessor Systems
- 3.4 Relationship with SCHED_DEADLINE Parameters
- 4. Bandwidth management
- 4.1 System-wide settings
- 4.2 Task interface
- 4.3 Default behavior
- 4.4 Behavior of sched_yield()
- 5. Tasks CPU affinity
- 5.1 Using cgroup v1 cpuset controller
- 5.2 Using cgroup v2 cpuset controller
- 6. Future plans
- A. Test suite
- B. Minimal main()
-
-
-0. WARNING
-==========
+WARNING
+=======
Fiddling with these settings can result in an unpredictable or even unstable
system behavior. As for -rt (group) scheduling, it is assumed that root users
know what they're doing.
-1. Overview
-===========
+Overview
+========
The SCHED_DEADLINE policy contained inside the sched_dl scheduling class is
basically an implementation of the Earliest Deadline First (EDF) scheduling
algorithm, augmented with a mechanism (called Constant Bandwidth Server, CBS)
that makes it possible to isolate the behavior of tasks between each other.
+.. _scheduling_algorithm:
-2. Scheduling algorithm
-=======================
+Scheduling algorithm
+====================
-2.1 Main algorithm
-------------------
+Main algorithm
+--------------
SCHED_DEADLINE [18] uses three parameters, named "runtime", "period", and
"deadline", to schedule tasks. A SCHED_DEADLINE task should receive
@@ -60,7 +36,7 @@ Deadline Task Scheduling
scheduled using EDF[1] on these scheduling deadlines (the task with the
earliest scheduling deadline is selected for execution). Notice that the
task actually receives "runtime" time units within "deadline" if a proper
- "admission control" strategy (see Section "4. Bandwidth management") is used
+ "admission control" strategy (see :ref:`bandwidth_management`) is used
(clearly, if the system is overloaded this guarantee cannot be respected).
Summing up, the CBS[2,3] algorithm assigns scheduling deadlines to tasks so
@@ -68,8 +44,8 @@ Deadline Task Scheduling
interference between different tasks (bandwidth isolation), while the EDF[1]
algorithm selects the task with the earliest scheduling deadline as the one
to be executed next. Thanks to this feature, tasks that do not strictly comply
- with the "traditional" real-time task model (see Section 3) can effectively
- use the new policy.
+ with the "traditional" real-time task model (see :ref:`scheduling_real_time_tasks`)
+ can effectively use the new policy.
In more details, the CBS algorithm assigns scheduling deadlines to
tasks in the following way:
@@ -123,8 +99,8 @@ Deadline Task Scheduling
signals.
-2.2 Bandwidth reclaiming
-------------------------
+Bandwidth reclaiming
+--------------------
Bandwidth reclaiming for deadline tasks is based on the GRUB (Greedy
Reclamation of Unused Bandwidth) algorithm [15, 16, 17] and it is enabled
@@ -287,8 +263,8 @@ Deadline Task Scheduling
running_bw is incremented.
-2.3 Energy-aware scheduling
----------------------------
+Energy-aware scheduling
+-----------------------
When cpufreq's schedutil governor is selected, SCHED_DEADLINE implements the
GRUB-PA [19] algorithm, reducing the CPU operating frequency to the minimum
@@ -299,9 +275,10 @@ Deadline Task Scheduling
is of the same order of magnitude of the reservation period. In such cases,
setting a fixed CPU frequency results in a lower amount of deadline misses.
+.. _scheduling_real_time_tasks:
-3. Scheduling Real-Time Tasks
-=============================
+Scheduling Real-Time Tasks
+==========================
@@ -311,7 +288,7 @@ Deadline Task Scheduling
This section contains a (not-thorough) summary on classical deadline
scheduling theory, and how it applies to SCHED_DEADLINE.
- The reader can "safely" skip to Section 4 if only interested in seeing
+ The reader can "safely" skip to :ref:`bandwidth_management` if only interested in seeing
how the scheduling policy can be used. Anyway, we strongly recommend
to come back here and continue reading (once the urge for testing is
satisfied :P) to be sure of fully understanding all technical details.
@@ -323,8 +300,8 @@ Deadline Task Scheduling
suited for periodic or sporadic real-time tasks that need guarantees on their
timing behavior, e.g., multimedia, streaming, control applications, etc.
-3.1 Definitions
-------------------------
+Definitions
+-----------
A typical real-time task is composed of a repetition of computation phases
(task instances, or jobs) which are activated on a periodic or sporadic
@@ -369,8 +346,8 @@ Deadline Task Scheduling
is the minimum WCET, and U_max = max{WCET_i/P_i} is the maximum
utilization[12].
-3.2 Schedulability Analysis for Uniprocessor Systems
-----------------------------------------------------
+Schedulability Analysis for Uniprocessor Systems
+------------------------------------------------
If M=1 (uniprocessor system), or in case of partitioned scheduling (each
real-time task is statically assigned to one and only one CPU), it is
@@ -411,11 +388,12 @@ Deadline Task Scheduling
between 0 and a maximum value L. The cited papers contain all of the
mathematical details and explain how to compute h(t) and L.
In any case, this kind of analysis is too complex as well as too
- time-consuming to be performed on-line. Hence, as explained in Section
- 4 Linux uses an admission test based on the tasks' utilizations.
+ time-consuming to be performed on-line. Hence, as explained in
+ :ref:`bandwidth_management`
+ Linux uses an admission test based on the tasks' utilizations.
-3.3 Schedulability Analysis for Multiprocessor Systems
-------------------------------------------------------
+Schedulability Analysis for Multiprocessor Systems
+--------------------------------------------------
On multiprocessor systems with global EDF scheduling (non partitioned
systems), a sufficient test for schedulability can not be based on the
@@ -464,16 +442,17 @@ Deadline Task Scheduling
the total utilization is smaller or equal than M then the response times of
the tasks are limited.
-3.4 Relationship with SCHED_DEADLINE Parameters
------------------------------------------------
+Relationship with SCHED_DEADLINE Parameters
+-------------------------------------------
Finally, it is important to understand the relationship between the
- SCHED_DEADLINE scheduling parameters described in Section 2 (runtime,
+ SCHED_DEADLINE scheduling parameters described in
+ :ref:`scheduling_algorithm` (runtime,
deadline and period) and the real-time task parameters (WCET, D, P)
described in this section. Note that the tasks' temporal constraints are
represented by its absolute deadlines d_j = r_j + D described above, while
SCHED_DEADLINE schedules the tasks according to scheduling deadlines (see
- Section 2).
+ :ref:`scheduling_algorithm`).
If an admission test is used to guarantee that the scheduling deadlines
are respected, then SCHED_DEADLINE can be used to schedule real-time tasks
guaranteeing that all the jobs' deadlines of a task are respected.
@@ -549,8 +528,10 @@ Deadline Task Scheduling
2018), Pau, France, April 2018.
-4. Bandwidth management
-=======================
+.. _bandwidth_management:
+
+Bandwidth management
+====================
As previously mentioned, in order for -deadline scheduling to be
effective and useful (that is, to be able to provide "runtime" time units
@@ -559,7 +540,8 @@ Deadline Task Scheduling
This is usually called "admission control" and if it is not performed, then
no guarantee can be given on the actual scheduling of the -deadline tasks.
- As already stated in Section 3, a necessary condition to be respected to
+ As already stated in :ref:`scheduling_real_time_tasks`,
+ a necessary condition to be respected to
correctly schedule a set of real-time tasks is that the total utilization
is smaller than M. When talking about -deadline tasks, this requires that
the sum of the ratio between runtime and period for all tasks is smaller
@@ -587,13 +569,13 @@ Deadline Task Scheduling
interface we can put a cap on total utilization of -deadline tasks (i.e.,
\Sum (runtime_i / period_i) < global_dl_utilization_cap).
-4.1 System wide settings
-------------------------
+System wide settings
+--------------------
The system wide settings are configured under /sys/kernel/sched.
- The ideal situation (see 5.) is to run -rt tasks from a -deadline server; in
- which case the -rt bandwidth is a direct subset of dl_bw.
+ The ideal situation (see ref:`tasks_cpu_affinity`) is to run -rt tasks from a
+ -deadline server; in which case the -rt bandwidth is a direct subset of dl_bw.
This means that, for a root_domain comprising M CPUs, -deadline tasks
can be created while the sum of their bandwidths stays below:
@@ -604,9 +586,8 @@ Deadline Task Scheduling
be thus free of oversubscribing the system up to any arbitrary level.
This is done by writing -1 in /sys/kernel/sched/dl_runtime_us.
-
-4.2 Task interface
-------------------
+Task interface
+--------------
Specifying a periodic/sporadic task that executes for a given amount of
runtime at each instance, and that is scheduled according to the urgency of
@@ -640,8 +621,8 @@ Deadline Task Scheduling
reference, that is not directly usable from user-space.
-4.3 Default behavior
----------------------
+Default behavior
+----------------
The default value for SCHED_DEADLINE bandwidth is to have dl_runtime_us equal to
1000000. With rt_period equal to 1000000, by default, it means that -deadline
@@ -651,7 +632,8 @@ Deadline Task Scheduling
and that -deadline tasks will receive their runtime with a guaranteed
worst-case delay respect to the "deadline" parameter. If "deadline" = "period"
and the cpuset mechanism is used to implement partitioned scheduling (see
- Section 5), then this simple setting of the bandwidth management is able to
+ :ref:`tasks_cpu_affinity`),
+ then this simple setting of the bandwidth management is able to
deterministically guarantee that -deadline tasks will receive their runtime
in a period.
@@ -659,8 +641,8 @@ Deadline Task Scheduling
-deadline task cannot fork.
-4.4 Behavior of sched_yield()
------------------------------
+Behavior of sched_yield()
+-------------------------
When a SCHED_DEADLINE task calls sched_yield(), it gives up its
remaining runtime and is immediately throttled, until the next
@@ -674,9 +656,10 @@ Deadline Task Scheduling
make the leftoever runtime available for reclamation by other
SCHED_DEADLINE tasks.
+.. _tasks_cpu_affinity:
-5. Tasks CPU affinity
-=====================
+Tasks CPU affinity
+==================
Deadline tasks cannot have a cpu affinity mask smaller than the root domain they
are created on. So, using ``sched_setaffinity(2)`` won't work. Instead, the
@@ -685,8 +668,8 @@ Deadline Task Scheduling
See :ref:`Documentation/admin-guide/cgroup-v1/cpusets.rst <cpusets>` and
:ref:`Documentation/admin-guide/cgroup-v2.rst <cgroup-v2>` for more information.
-5.1 Using cgroup v1 cpuset controller
--------------------------------------
+Using cgroup v1 cpuset controller
+---------------------------------
An example of a simple configuration (pin a -deadline task to CPU0) follows::
@@ -703,8 +686,8 @@ Deadline Task Scheduling
echo $$ > cpu0/tasks
chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
-5.2 Using cgroup v2 cpuset controller
--------------------------------------
+Using cgroup v2 cpuset controller
+---------------------------------
Assuming the cgroup v2 root is mounted at ``/sys/fs/cgroup``, an example of a
simple configuration (pin a -deadline task to CPU0) follows::
@@ -717,8 +700,8 @@ Deadline Task Scheduling
echo $$ > deadline_group/cgroup.procs
chrt --sched-runtime 100000 --sched-period 200000 --deadline 0 yes > /dev/null
-6. Future plans
-===============
+Future plans
+============
Still missing:
--
2.55.0
Sebastian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-23 14:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:41 [PATCH v4 0/6] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 1/6] sched: Mark RT_GROUP_SCHED broken Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 2/6] sched: Move DL's admission control to sysfs Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 3/6] sched: Add sysfs files for the per-CPU fair_server knobs Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 4/6] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 5/6] Documentation/sched: Drop the section enumeration in sched-deadline Sebastian Andrzej Siewior
2026-11-23 14:17 ` Sebastian Andrzej Siewior
2026-11-23 13:41 ` [PATCH v4 6/6] Documentation/sched: Add fairserver to sched-deadline Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox