* [PATCH v3 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0
2026-03-23 12:39 [PATCH v3 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
@ 2026-03-23 12:39 ` Michal Koutný
2026-04-08 11:20 ` [tip: sched/core] " tip-bot2 for Michal Koutný
2026-03-23 12:39 ` [PATCH v3 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
2026-03-23 12:39 ` [PATCH v3 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
2 siblings, 1 reply; 7+ messages in thread
From: Michal Koutný @ 2026-03-23 12:39 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider
Cc: linux-kernel, K Prateek Nayak, Michal Koutný
The warning from the commit 87f1fb77d87a6 ("sched: Add RT_GROUP WARN
checks for non-root task_groups") is wrong -- it assumes that only
task_groups with rt_rq are traversed, however, the schedulability check
would iterate all task_groups even when rt_group_sched=0 is disabled at
boot time but some non-root task_groups exist.
The schedulability check is supposed to validate:
a) that children don't overcommit its parent,
b) no RT task group overcommits global RT limit.
but with rt_group_sched=0 there is no (non-trivial) hierarchy of RT groups,
therefore skip the validation altogether. Otherwise, writes to the
global sched_rt_runtime_us knob will be rejected with incorrect
validation error.
This fix is immaterial with CONFIG_RT_GROUP_SCHED=n.
Fixes: 87f1fb77d87a6 ("sched: Add RT_GROUP WARN checks for non-root task_groups")
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
kernel/sched/rt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index f69e1f16d9238..37e6ce3604fd7 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2676,9 +2676,6 @@ static int tg_rt_schedulable(struct task_group *tg, void *data)
tg->rt_bandwidth.rt_runtime && tg_has_rt_tasks(tg))
return -EBUSY;
- if (WARN_ON(!rt_group_sched_enabled() && tg != &root_task_group))
- return -EBUSY;
-
total = to_ratio(period, runtime);
/*
@@ -2822,6 +2819,8 @@ long sched_group_rt_period(struct task_group *tg)
static int sched_rt_global_constraints(void)
{
int ret = 0;
+ if (!rt_group_sched_enabled())
+ return ret;
mutex_lock(&rt_constraints_mutex);
ret = __rt_schedulable(NULL, 0, 0);
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [tip: sched/core] sched/rt: Skip group schedulable check with rt_group_sched=0
2026-03-23 12:39 ` [PATCH v3 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
@ 2026-04-08 11:20 ` tip-bot2 for Michal Koutný
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Michal Koutný @ 2026-04-08 11:20 UTC (permalink / raw)
To: linux-tip-commits; +Cc: mkoutny, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 8b016dcec9365675be81d26be88f2c09cf983bd4
Gitweb: https://git.kernel.org/tip/8b016dcec9365675be81d26be88f2c09cf983bd4
Author: Michal Koutný <mkoutny@suse.com>
AuthorDate: Mon, 23 Mar 2026 13:39:37 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 08 Apr 2026 13:11:44 +02:00
sched/rt: Skip group schedulable check with rt_group_sched=0
The warning from the commit 87f1fb77d87a6 ("sched: Add RT_GROUP WARN
checks for non-root task_groups") is wrong -- it assumes that only
task_groups with rt_rq are traversed, however, the schedulability check
would iterate all task_groups even when rt_group_sched=0 is disabled at
boot time but some non-root task_groups exist.
The schedulability check is supposed to validate:
a) that children don't overcommit its parent,
b) no RT task group overcommits global RT limit.
but with rt_group_sched=0 there is no (non-trivial) hierarchy of RT groups,
therefore skip the validation altogether. Otherwise, writes to the
global sched_rt_runtime_us knob will be rejected with incorrect
validation error.
This fix is immaterial with CONFIG_RT_GROUP_SCHED=n.
Fixes: 87f1fb77d87a6 ("sched: Add RT_GROUP WARN checks for non-root task_groups")
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260323-sched-rert_groups-v3-1-1e7d5ed6b249@suse.com
---
kernel/sched/rt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a48e867..893e54d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2690,9 +2690,6 @@ static int tg_rt_schedulable(struct task_group *tg, void *data)
tg->rt_bandwidth.rt_runtime && tg_has_rt_tasks(tg))
return -EBUSY;
- if (WARN_ON(!rt_group_sched_enabled() && tg != &root_task_group))
- return -EBUSY;
-
total = to_ratio(period, runtime);
/*
@@ -2836,6 +2833,8 @@ long sched_group_rt_period(struct task_group *tg)
static int sched_rt_global_constraints(void)
{
int ret = 0;
+ if (!rt_group_sched_enabled())
+ return ret;
mutex_lock(&rt_constraints_mutex);
ret = __rt_schedulable(NULL, 0, 0);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate()
2026-03-23 12:39 [PATCH v3 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
2026-03-23 12:39 ` [PATCH v3 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
@ 2026-03-23 12:39 ` Michal Koutný
2026-04-08 11:20 ` [tip: sched/core] " tip-bot2 for Michal Koutný
2026-03-23 12:39 ` [PATCH v3 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
2 siblings, 1 reply; 7+ messages in thread
From: Michal Koutný @ 2026-03-23 12:39 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider
Cc: linux-kernel, K Prateek Nayak, Michal Koutný
The sched_rt_global_constraints() function is a remnant that used to set
up global RT throttling but that is no more since commit 5f6bd380c7bdb
("sched/rt: Remove default bandwidth control") and the function ended up
only doing schedulability check.
Move the check into the validation function where it fits better.
(The order of validations sched_dl_global_validate() and
sched_rt_global_validate() shouldn't matter.)
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
kernel/sched/rt.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 37e6ce3604fd7..d3b6483fc3e7a 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2818,15 +2818,7 @@ long sched_group_rt_period(struct task_group *tg)
#ifdef CONFIG_SYSCTL
static int sched_rt_global_constraints(void)
{
- int ret = 0;
- if (!rt_group_sched_enabled())
- return ret;
-
- mutex_lock(&rt_constraints_mutex);
- ret = __rt_schedulable(NULL, 0, 0);
- mutex_unlock(&rt_constraints_mutex);
-
- return ret;
+ return 0;
}
#endif /* CONFIG_SYSCTL */
@@ -2858,6 +2850,13 @@ static int sched_rt_global_validate(void)
NSEC_PER_USEC > max_rt_runtime)))
return -EINVAL;
+#ifdef CONFIG_RT_GROUP_SCHED
+ if (!rt_group_sched_enabled())
+ return 0;
+
+ scoped_guard(mutex, &rt_constraints_mutex)
+ return __rt_schedulable(NULL, 0, 0);
+#endif
return 0;
}
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [tip: sched/core] sched/rt: Move group schedulability check to sched_rt_global_validate()
2026-03-23 12:39 ` [PATCH v3 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
@ 2026-04-08 11:20 ` tip-bot2 for Michal Koutný
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Michal Koutný @ 2026-04-08 11:20 UTC (permalink / raw)
To: linux-tip-commits; +Cc: mkoutny, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 4f70a0456d090303d5a6c915dd7d9db9da56cb16
Gitweb: https://git.kernel.org/tip/4f70a0456d090303d5a6c915dd7d9db9da56cb16
Author: Michal Koutný <mkoutny@suse.com>
AuthorDate: Mon, 23 Mar 2026 13:39:38 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 08 Apr 2026 13:11:44 +02:00
sched/rt: Move group schedulability check to sched_rt_global_validate()
The sched_rt_global_constraints() function is a remnant that used to set
up global RT throttling but that is no more since commit 5f6bd380c7bdb
("sched/rt: Remove default bandwidth control") and the function ended up
only doing schedulability check.
Move the check into the validation function where it fits better.
(The order of validations sched_dl_global_validate() and
sched_rt_global_validate() shouldn't matter.)
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260323-sched-rert_groups-v3-2-1e7d5ed6b249@suse.com
---
kernel/sched/rt.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 893e54d..e16d8f1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2832,15 +2832,7 @@ long sched_group_rt_period(struct task_group *tg)
#ifdef CONFIG_SYSCTL
static int sched_rt_global_constraints(void)
{
- int ret = 0;
- if (!rt_group_sched_enabled())
- return ret;
-
- mutex_lock(&rt_constraints_mutex);
- ret = __rt_schedulable(NULL, 0, 0);
- mutex_unlock(&rt_constraints_mutex);
-
- return ret;
+ return 0;
}
#endif /* CONFIG_SYSCTL */
@@ -2872,6 +2864,13 @@ static int sched_rt_global_validate(void)
NSEC_PER_USEC > max_rt_runtime)))
return -EINVAL;
+#ifdef CONFIG_RT_GROUP_SCHED
+ if (!rt_group_sched_enabled())
+ return 0;
+
+ scoped_guard(mutex, &rt_constraints_mutex)
+ return __rt_schedulable(NULL, 0, 0);
+#endif
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] sched/rt: Cleanup global RT bandwidth functions
2026-03-23 12:39 [PATCH v3 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
2026-03-23 12:39 ` [PATCH v3 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
2026-03-23 12:39 ` [PATCH v3 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
@ 2026-03-23 12:39 ` Michal Koutný
2026-04-08 11:20 ` [tip: sched/core] " tip-bot2 for Michal Koutný
2 siblings, 1 reply; 7+ messages in thread
From: Michal Koutný @ 2026-03-23 12:39 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider
Cc: linux-kernel, K Prateek Nayak, Michal Koutný
The commit 5f6bd380c7bdb ("sched/rt: Remove default bandwidth control")
and followup changes made a few of the functions unnecessary, drop them
for simplicity.
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
kernel/sched/rt.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index d3b6483fc3e7a..87ed7268fd547 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2815,13 +2815,6 @@ long sched_group_rt_period(struct task_group *tg)
return rt_period_us;
}
-#ifdef CONFIG_SYSCTL
-static int sched_rt_global_constraints(void)
-{
- return 0;
-}
-#endif /* CONFIG_SYSCTL */
-
int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
{
/* Don't accept real-time tasks when there is no way for them to run */
@@ -2831,14 +2824,6 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
return 1;
}
-#else /* !CONFIG_RT_GROUP_SCHED: */
-
-#ifdef CONFIG_SYSCTL
-static int sched_rt_global_constraints(void)
-{
- return 0;
-}
-#endif /* CONFIG_SYSCTL */
#endif /* !CONFIG_RT_GROUP_SCHED */
#ifdef CONFIG_SYSCTL
@@ -2860,10 +2845,6 @@ static int sched_rt_global_validate(void)
return 0;
}
-static void sched_rt_do_global(void)
-{
-}
-
static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -2887,11 +2868,6 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
if (ret)
goto undo;
- ret = sched_rt_global_constraints();
- if (ret)
- goto undo;
-
- sched_rt_do_global();
sched_dl_do_global();
}
if (0) {
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [tip: sched/core] sched/rt: Cleanup global RT bandwidth functions
2026-03-23 12:39 ` [PATCH v3 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
@ 2026-04-08 11:20 ` tip-bot2 for Michal Koutný
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Michal Koutný @ 2026-04-08 11:20 UTC (permalink / raw)
To: linux-tip-commits; +Cc: mkoutny, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 985215804dcbf02ab675977e770708e3f084e9fc
Gitweb: https://git.kernel.org/tip/985215804dcbf02ab675977e770708e3f084e9fc
Author: Michal Koutný <mkoutny@suse.com>
AuthorDate: Mon, 23 Mar 2026 13:39:39 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 08 Apr 2026 13:11:44 +02:00
sched/rt: Cleanup global RT bandwidth functions
The commit 5f6bd380c7bdb ("sched/rt: Remove default bandwidth control")
and followup changes made a few of the functions unnecessary, drop them
for simplicity.
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260323-sched-rert_groups-v3-3-1e7d5ed6b249@suse.com
---
kernel/sched/rt.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index e16d8f1..4ee8faf 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2829,13 +2829,6 @@ long sched_group_rt_period(struct task_group *tg)
return rt_period_us;
}
-#ifdef CONFIG_SYSCTL
-static int sched_rt_global_constraints(void)
-{
- return 0;
-}
-#endif /* CONFIG_SYSCTL */
-
int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
{
/* Don't accept real-time tasks when there is no way for them to run */
@@ -2845,14 +2838,6 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
return 1;
}
-#else /* !CONFIG_RT_GROUP_SCHED: */
-
-#ifdef CONFIG_SYSCTL
-static int sched_rt_global_constraints(void)
-{
- return 0;
-}
-#endif /* CONFIG_SYSCTL */
#endif /* !CONFIG_RT_GROUP_SCHED */
#ifdef CONFIG_SYSCTL
@@ -2874,10 +2859,6 @@ static int sched_rt_global_validate(void)
return 0;
}
-static void sched_rt_do_global(void)
-{
-}
-
static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -2901,11 +2882,6 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
if (ret)
goto undo;
- ret = sched_rt_global_constraints();
- if (ret)
- goto undo;
-
- sched_rt_do_global();
sched_dl_do_global();
}
if (0) {
^ permalink raw reply [flat|nested] 7+ messages in thread