Skip to contentSkip to conversation

sched: Remove CONFIG_RT_GROUP_SCHED

PATCH In review Sebastian Andrzej Siewior 4 participants 10 messages Nov 5 – Nov 7

Subsystems (4)
lore
Share & tools
lore

Sebastian Andrzej Siewior

author maintainer
#0 lore raw

PATCH 1/1 sched: Remove CONFIG_RT_GROUP_SCHED

The RT_GROUP_SCHED is broken beyond repair and it is 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.

I don't think it is needed to somehow fix RT_GROUP_SCHED. The DL fair server already handles the RT throttling mechanism. There is work on Hierarchical constant bandwidth server (HCBS) which aim to group multiple real-time tasks within one deadline configuration.

Remove CONFIG_RT_GROUP_SCHED.

---

Follow-up to https://lore.kernel.org/all/[email protected]/
First step.

 Documentation/admin-guide/cgroup-v2.rst       |  15 +-
 .../admin-guide/kernel-parameters.txt         |   5 -
 Documentation/scheduler/index.rst             |   1 -
 Documentation/scheduler/sched-bwc.rst         |   1 -
 Documentation/scheduler/sched-deadline.rst    |  19 +-
 Documentation/scheduler/sched-design-CFS.rst  |   3 -
 Documentation/scheduler/sched-rt-group.rst    | 190 ----
 include/linux/sched.h                         |   7 -
 init/Kconfig                                  |  22 -
 kernel/sched/autogroup.c                      |  17 -
 kernel/sched/core.c                           | 111 +--
 kernel/sched/deadline.c                       |  26 -
 kernel/sched/debug.c                          |  10 -
 kernel/sched/features.h                       |   1 -
 kernel/sched/rt.c                             | 925 ------------------
 kernel/sched/sched.h                          |  87 +-
 kernel/sched/syscalls.c                       |  13 -
 17 files changed, 15 insertions(+), 1438 deletions(-)
 delete mode 100644 Documentation/scheduler/sched-rt-group.rst
Documentation/admin-guide/cgroup-v2.rst +1 -14
index 9e3c67b02ae2e..f8ee6e63f1775 100644
@@ -1107,20 +1107,7 @@ provided by a CPU, as well as the maximum desired frequency, which should not
 be exceeded by a CPU.
 
 WARNING: cgroup2 cpu controller doesn't yet support the (bandwidth) control of
-realtime processes. For a kernel built with the CONFIG_RT_GROUP_SCHED option
-enabled for group scheduling of realtime processes, the cpu controller can only
-be enabled when all RT processes are in the root cgroup. Be aware that system
-management software may already have placed RT processes into non-root cgroups
-during the system boot process, and these processes may need to be moved to the
-root cgroup before the cpu controller can be enabled with a
-CONFIG_RT_GROUP_SCHED enabled kernel.
-
-With CONFIG_RT_GROUP_SCHED disabled, this limitation does not apply and some of
-the interface files either affect realtime processes or account for them. See
-the following section for details. Only the cpu controller is affected by
-CONFIG_RT_GROUP_SCHED. Other controllers can be used for the resource control of
-realtime processes irrespective of CONFIG_RT_GROUP_SCHED.
-
+realtime processes.
 
 CPU Interface Files
 ~~~~~~~~~~~~~~~~~~~
Documentation/admin-guide/kernel-parameters.txt +0 -5
index 0b3c140babd94..188ca6844e970 100644
@@ -6778,11 +6778,6 @@ Kernel parameters
 			debug mode. Defaults to CONFIG_RSEQ_DEBUG_DEFAULT_ENABLE.
 			Format: <bool>
 
-	rt_group_sched=	[KNL] Enable or disable SCHED_RR/FIFO group scheduling
-			when CONFIG_RT_GROUP_SCHED=y. Defaults to
-			!CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED.
-			Format: <bool>
-
 	rw		[KNL] Mount root device read-write on boot
 
 	S		[KNL] Run init in single mode
Documentation/scheduler/index.rst +0 -1
index 791178ac8bec6..a9b3295e7c8ff 100644
@@ -19,7 +19,6 @@ Scheduler
     schedutil
     sched-util-clamp
     sched-nice-design
-    sched-rt-group
     sched-stats
     sched-ext
     sched-debug
Documentation/scheduler/sched-bwc.rst +0 -1
index e881a945c1888..2402be2d09f0d 100644
@@ -4,7 +4,6 @@ CFS Bandwidth Control
 
 .. note::
    This document only discusses CPU bandwidth control for SCHED_NORMAL.
-   The SCHED_RT case is covered in Documentation/scheduler/sched-rt-group.rst
 
 CFS bandwidth control is a CONFIG_FAIR_GROUP_SCHED extension which allows the
 specification of the maximum CPU bandwidth available to a group or hierarchy.
Documentation/scheduler/sched-deadline.rst +8 -11
index 9019b66f6a5ba..1ad59e918a454 100644
@@ -567,10 +567,8 @@ Deadline Task Scheduling
  of a "traditional" real-time task, and is also often referred to as
  "bandwidth".
  The interface used to control the CPU bandwidth that can be allocated
- to -deadline tasks is similar to the one already used for -rt
- tasks with real-time group scheduling (a.k.a. RT-throttling - see
- Documentation/scheduler/sched-rt-group.rst), and is based on readable/
- writable control files located in procfs (for system wide settings).
+ to -deadline tasks is based on readable/ writable control files located in
+ procfs (for system wide settings).
  Notice that per-group settings (controlled through cgroupfs) are still not
  defined for -deadline tasks, because more discussion is needed in order to
  figure out how we want to manage SCHED_DEADLINE bandwidth at the task group
@@ -592,13 +590,12 @@ Deadline Task Scheduling
 
  The system wide settings are configured under the /proc virtual file system.
 
- 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.
+ For now the -rt knobs are used for -deadline admission control. 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.
 
  This means that, for a root_domain comprising M CPUs, -deadline tasks
  can be created while the sum of their bandwidths stays below:
Documentation/scheduler/sched-design-CFS.rst +0 -3
index 03998f6c8f9c4..5d58f1f3592b9 100644
@@ -220,9 +220,6 @@ each task belonging to a user.
 CONFIG_CGROUP_SCHED strives to achieve exactly that.  It lets tasks to be
 grouped and divides CPU time fairly among such groups.
 
-CONFIG_RT_GROUP_SCHED permits to group real-time (i.e., SCHED_FIFO and
-SCHED_RR) tasks.
-
 CONFIG_FAIR_GROUP_SCHED permits to group CFS (i.e., SCHED_NORMAL and
 SCHED_BATCH) tasks.
 
Documentation/scheduler/sched-rt-group.rst deleted +0 -190

190 lines not on this page · raw message

include/linux/sched.h +0 -7
index 1c93da75226e3..ea6d0cab63f88 100644
@@ -628,13 +628,6 @@ struct sched_rt_entity {
 	unsigned short			on_list;
 
 	struct sched_rt_entity		*back;
-#ifdef CONFIG_RT_GROUP_SCHED
-	struct sched_rt_entity		*parent;
-	/* rq on which this entity is (to be) queued: */
-	struct rt_rq			*rt_rq;
-	/* rq "owned" by this entity/group: */
-	struct rt_rq			*my_q;
-#endif
 } __randomize_layout;
 
 struct rq_flags;
init/Kconfig +0 -22
index 4013781e0a029..3a49369e40430 100644
@@ -978,28 +978,6 @@ config CFS_BANDWIDTH
 	  restriction.
 	  See Documentation/scheduler/sched-bwc.rst for more information.
 
-config RT_GROUP_SCHED
-	bool "Group scheduling for SCHED_RR/FIFO"
-	depends on CGROUP_SCHED
-	default n
-	help
-	  This feature lets you explicitly allocate real CPU bandwidth
-	  to task groups. If enabled, it will also make it impossible to
-	  schedule realtime tasks for non-root users until you allocate
-	  realtime bandwidth for them.
-	  See Documentation/scheduler/sched-rt-group.rst for more information.
-
-config RT_GROUP_SCHED_DEFAULT_DISABLED
-	bool "Require boot parameter to enable group scheduling for SCHED_RR/FIFO"
-	depends on RT_GROUP_SCHED
-	default n
-	help
-	  When set, the RT group scheduling is disabled by default. The option
-	  is in inverted form so that mere RT_GROUP_SCHED enables the group
-	  scheduling.
-
-	  Say N if unsure.
-
 config EXT_GROUP_SCHED
 	bool
 	depends on SCHED_CLASS_EXT && CGROUP_SCHED
kernel/sched/autogroup.c +0 -17
index e380cf9372bbd..e9b25a4ea0b36 100644
@@ -50,11 +50,6 @@ static inline void autogroup_destroy(struct kref *kref)
 {
 	struct autogroup *ag = container_of(kref, struct autogroup, kref);
 
-#ifdef CONFIG_RT_GROUP_SCHED
-	/* We've redirected RT tasks to the root task group... */
-	ag->tg->rt_se = NULL;
-	ag->tg->rt_rq = NULL;
-#endif
 	sched_release_group(ag->tg);
 	sched_destroy_group(ag->tg);
 }
@@ -100,18 +95,6 @@ static inline struct autogroup *autogroup_create(void)
 	init_rwsem(&ag->lock);
 	ag->id = atomic_inc_return(&autogroup_seq_nr);
 	ag->tg = tg;
-#ifdef CONFIG_RT_GROUP_SCHED
-	/*
-	 * Autogroup RT tasks are redirected to the root task group
-	 * so we don't have to move tasks around upon policy change,
-	 * or flail around trying to allocate bandwidth on the fly.
-	 * A bandwidth exception in __sched_setscheduler() allows
-	 * the policy change to proceed.
-	 */
-	free_rt_sched_group(tg);
-	tg->rt_se = root_task_group.rt_se;
-	tg->rt_rq = root_task_group.rt_rq;
-#endif /* CONFIG_RT_GROUP_SCHED */
 	tg->autogroup = ag;
 
 	sched_online_group(tg, &root_task_group);
kernel/sched/core.c +1 -110

150 lines not on this page · raw message

kernel/sched/deadline.c +0 -26
index c0ebdcde5fe5d..076a6c2f017bb 100644
@@ -1540,32 +1540,6 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
 	if (dl_se->dl_server)
 		return;
 
-#ifdef CONFIG_RT_GROUP_SCHED
-	/*
-	 * Because -- for now -- we share the rt bandwidth, we need to
-	 * account our runtime there too, otherwise actual rt tasks
-	 * would be able to exceed the shared quota.
-	 *
-	 * Account to the root rt group for now.
-	 *
-	 * The solution we're working towards is having the RT groups scheduled
-	 * using deadline servers -- however there's a few nasties to figure
-	 * out before that can happen.
-	 */
-	if (rt_bandwidth_enabled()) {
-		struct rt_rq *rt_rq = &rq->rt;
-
-		raw_spin_lock(&rt_rq->rt_runtime_lock);
-		/*
-		 * We'll let actual RT tasks worry about the overflow here, we
-		 * have our own CBS to keep us inline; only account when RT
-		 * bandwidth is relevant.
-		 */
-		if (sched_rt_bandwidth_account(rt_rq))
-			rt_rq->rt_time += delta_exec;
-		raw_spin_unlock(&rt_rq->rt_runtime_lock);
-	}
-#endif /* CONFIG_RT_GROUP_SCHED */
 }
 
 /*
kernel/sched/debug.c +0 -10
index e6a3b516c703b..b5c203925d075 100644
@@ -1127,13 +1127,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 
 void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 {
-#ifdef CONFIG_RT_GROUP_SCHED
-	SEQ_printf(m, "\n");
-	SEQ_printf_task_group_path(m, rt_rq->tg, "rt_rq[%d]:%s\n", cpu);
-#else
 	SEQ_printf(m, "\n");
 	SEQ_printf(m, "rt_rq[%d]:\n", cpu);
-#endif
 
 #define P(x) \
 	SEQ_printf(m, "  .%-30s: %Ld\n", #x, (long long)(rt_rq->x))
@@ -1144,11 +1139,6 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
 
 	PU(rt_nr_running);
 
-#ifdef CONFIG_RT_GROUP_SCHED
-	P(rt_throttled);
-	PN(rt_time);
-	PN(rt_runtime);
-#endif
 
 #undef PN
 #undef PU
kernel/sched/features.h +0 -1
index 8f0dee8fc4755..729ec5ee2e399 100644
@@ -122,7 +122,6 @@ SCHED_FEAT(RT_PUSH_IPI, false)
 # endif
 #endif
 
-SCHED_FEAT(RT_RUNTIME_SHARE, false)
 SCHED_FEAT(LB_MIN, false)
 SCHED_FEAT(ATTACH_AGE_LOAD, true)
 
kernel/sched/rt.c +0 -925

1,006 lines not on this page · raw message

kernel/sched/sched.h +5 -82

147 lines not on this page · raw message

kernel/sched/syscalls.c +0 -13
index 45a127deeadd9..02688e75a8bd6 100644
@@ -606,19 +606,6 @@ int __sched_setscheduler(struct task_struct *p,
 change:
 
 	if (user) {
-#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;
-			goto unlock;
-		}
-#endif /* CONFIG_RT_GROUP_SCHED */
 		if (dl_bandwidth_enabled() && dl_policy(policy) &&
 				!(attr->sched_flags & SCHED_FLAG_SUGOV)) {
 			cpumask_t *span = rq->rd->span;
Signature · 1 line
2.55.0
maintainer
#1 lore raw

Hello, Sebastian.

Quoted 15 lines · Sebastian Andrzej Siewior

The RT_GROUP_SCHED is broken beyond repair and it is 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.

Quoted 8 lines

I don't think it is needed to somehow fix RT_GROUP_SCHED. The DL fair server already handles the RT throttling mechanism. There is work on Hierarchical constant bandwidth server (HCBS) which aim to group multiple real-time tasks within one deadline configuration.

Remove CONFIG_RT_GROUP_SCHED.

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

Thanks.

Signature · 1 line
tejun
author maintainer
#2 lore raw
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

This depended on !PREEMPT_RT in the RT queue. People asked if this can be enabled because it looked useful/ for their use case. I researched why it was like this and dropped that restriction. People then asked if it is broken on RT because it is now working properly. I have never been told _what_ is broken or *why* because nobody came back. Later I've been told (there was an attempt to explain it to me, it was late in the morning) and if I piece it properly together then, it could work in UP environment but on SMP the accounting is wrong and therefore the runtime/ preemption is not working as it should.

I didn't add this to the commit description because I would classify this as hearsay and we do facts here. PeterZ might know more. From what I know, people who asked for it either have a different solution or eyeball HCBS.

Quoted 1 line

Thanks.

Sebastian

maintainer
#3 lore raw
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

So I would love to actually delete this. But IIRC there were actually people who used it.

But yes, we need to replace this with that other thing.

author maintainer
#4 lore raw
Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · Sebastian Andrzej Siewior
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

Quoted 5 lines
Quoted 2 lines

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

So I would love to actually delete this. But IIRC there were actually people who used it.

That would mean that it is working which does surprise me.

Quoted 1 line

But yes, we need to replace this with that other thing.

so no removal, keeping this thing that nobody can use? You don't give your love a chance?
The plan is to make HCBS appear as CONFIG_RT_GROUP_SCHED or do I mix up things?

Sebastian

maintainer
#5 lore raw
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Peter Zijlstra
Quoted 9 lines · Sebastian Andrzej Siewior
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

So I would love to actually delete this. But IIRC there were actually people who used it.

That would mean that it is working which does surprise me.

For some definition of 'work' :/

author maintainer
#6 lore raw
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Sebastian Andrzej Siewior
Quoted 13 lines · Peter Zijlstra
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

So I would love to actually delete this. But IIRC there were actually people who used it.

That would mean that it is working which does surprise me.

For some definition of 'work' :/

despite that statement, no removal, depends on broken, anything? Just keep everything as-is?

Sebastian

maintainer
#7 lore raw
Quoted 19 lines · Sebastian Andrzej Siewior
Quoted 18 lines · Peter Zijlstra
Quoted 17 lines · Sebastian Andrzej Siewior
Quoted 15 lines · Peter Zijlstra
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 1 line · Tejun Heo

Hello, Sebastian.

Hi Tejun,

Quoted 4 lines

I'm not against it but wonder whether it'd be useful to do it more gradually so that people can pipe up if they depend on it. ie. Mark it deprecated and put it behind EXPORT for a bit and then BROKEN before actual removal.

I would be surprised if this is actually used especially since it is cg-v1 and v2 is the default/ used by everyone (?).

So I would love to actually delete this. But IIRC there were actually people who used it.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

That would mean that it is working which does surprise me.

For some definition of 'work' :/

despite that statement, no removal, depends on broken, anything? Just keep everything as-is?

We can try marking it broken; see who screams this time ;-)

author maintainer
#8 lore raw
Quoted 1 line · Peter Zijlstra

We can try marking it broken; see who screams this time ;-)

okay. Let me try that then. Which reminds me of something…

Sebastian

#9 lore raw
Quoted 4 lines · Sebastian Andrzej Siewior
Quoted 1 line · Peter Zijlstra

We can try marking it broken; see who screams this time ;-)

okay. Let me try that then. Which reminds me of something…

FWIW I am trying to fix another broken piece due to RT throttling [1] and have been hitting a wall on how to get my systemd to mount cgroup v1 to run a test but no luck so far. I'd love for this to be deleted too :-)

For the whole deletion:

[1] https://lore.kernel.org/all/[email protected]/