mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	rcu@vger.kernel.org, linux-doc@vger.kernel.org
Cc: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"K Prateek Nayak" <kprateek.nayak@amd.com>,
	"luca abeni" <luca.abeni@santannapisa.it>,
	"Yuri Andriaccio" <yurand2000@gmail.com>,
	"Yuri Andriaccio" <yuri.andriaccio@santannapisa.it>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Frederic Weisbecker" <frederic@kernel.org>,
	"Neeraj Upadhyay" <neeraj.upadhyay@kernel.org>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Josh Triplett" <josh@joshtriplett.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"Lai Jiangshan" <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang@linux.dev>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Qais Yousef" <qyousef@layalina.io>,
	"John Ogness" <john.ogness@linutronix.de>
Subject: [PATCH v3 2/8] sched: Mark RT_GROUP_SCHED broken
Date: Fri, 13 Nov 2026 11:50:23 +0100	[thread overview]
Message-ID: <20261113-sched_dl-v3-2-a76ffa1cdeee@linutronix.de> (raw)
In-Reply-To: <20261113-sched_dl-v3-0-a76ffa1cdeee@linutronix.de>

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 4013781e0a029..7d5db38cc82c8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -980,7 +980,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 1d76950dbb0a1..a7964537bac75 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,
@@ -869,11 +880,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
@@ -3049,9 +3055,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


  parent reply	other threads:[~2026-11-13 10:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 10:50 [PATCH v3 0/8] sched: RT throttling cleanup and a bit of documentation Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 1/8] sched/deadline: Reject debugfs dl_server writes for not-active CPUs Sebastian Andrzej Siewior
2026-11-13 10:50 ` Sebastian Andrzej Siewior [this message]
2026-11-13 10:50 ` [PATCH v3 3/8] rcutorture: Don't try to disable to RT throttling Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 4/8] sched: rcutorture: Allow to disable DL fair_server Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 5/8] sched: Move DL's admission control to sysfs Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 6/8] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 7/8] sched: Add sysfs files for the per-CPU fair_server knobs Sebastian Andrzej Siewior
2026-11-13 10:50 ` [PATCH v3 8/8] Documentation/sched: Add fairserver to sched-deadline Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113-sched_dl-v3-2-a76ffa1cdeee@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=boqun@kernel.org \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joelagnelf@nvidia.com \
    --cc=john.ogness@linutronix.de \
    --cc=josh@joshtriplett.org \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@santannapisa.it \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qiang.zhang@linux.dev \
    --cc=qyousef@layalina.io \
    --cc=rcu@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tj@kernel.org \
    --cc=urezki@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yurand2000@gmail.com \
    --cc=yuri.andriaccio@santannapisa.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®