* [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups
@ 2026-01-19 17:41 Michal Koutný
2026-01-19 17:41 ` [PATCH 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Michal Koutný @ 2026-01-19 17:41 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, Michal Koutný
The crux is the first commit which fixes how sysctl
kernel.sched_rt_runtime_us changes are validated with
CONFIG_RT_GROUP_SCHED but rt_group_sched=0.
The rest are cleanups that occurred to me.
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
Michal Koutný (3):
sched/rt: Skip group schedulable check with rt_group_sched=0
sched/rt: Move group schedulability check to sched_rt_global_validate()
sched/rt: Cleanup global RT bandwidth functions
kernel/sched/rt.c | 42 +++++++++---------------------------------
1 file changed, 9 insertions(+), 33 deletions(-)
---
base-commit: 944aacb68baf7624ab8d277d0ebf07f025ca137c
change-id: 20260119-sched-rert_groups-431e2d5d1c57
Best regards,
--
Michal Koutný <mkoutny@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0
2026-01-19 17:41 [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
@ 2026-01-19 17:41 ` Michal Koutný
2026-01-19 17:41 ` [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Michal Koutný @ 2026-01-19 17:41 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, 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.
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 f1867fe8e5c53..2dfdf2d9471be 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2668,9 +2668,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);
/*
@@ -2814,6 +2811,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.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate()
2026-01-19 17:41 [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
2026-01-19 17:41 ` [PATCH 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
@ 2026-01-19 17:41 ` Michal Koutný
2026-02-11 7:57 ` K Prateek Nayak
2026-01-19 17:41 ` [PATCH 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
2026-02-02 14:13 ` [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
3 siblings, 1 reply; 6+ messages in thread
From: Michal Koutný @ 2026-01-19 17:41 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, 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 | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 2dfdf2d9471be..c621e61568359 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2810,15 +2810,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 */
@@ -2850,7 +2842,16 @@ static int sched_rt_global_validate(void)
NSEC_PER_USEC > max_rt_runtime)))
return -EINVAL;
- return 0;
+ int ret = 0;
+#ifdef CONFIG_RT_GROUP_SCHED
+ if (!rt_group_sched_enabled())
+ return ret;
+
+ mutex_lock(&rt_constraints_mutex);
+ ret = __rt_schedulable(NULL, 0, 0);
+ mutex_unlock(&rt_constraints_mutex);
+#endif
+ return ret;
}
static void sched_rt_do_global(void)
--
2.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] sched/rt: Cleanup global RT bandwidth functions
2026-01-19 17:41 [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
2026-01-19 17:41 ` [PATCH 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
2026-01-19 17:41 ` [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
@ 2026-01-19 17:41 ` Michal Koutný
2026-02-02 14:13 ` [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
3 siblings, 0 replies; 6+ messages in thread
From: Michal Koutný @ 2026-01-19 17:41 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, 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 c621e61568359..0031320d50703 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2807,13 +2807,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 */
@@ -2823,14 +2816,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
@@ -2854,10 +2839,6 @@ static int sched_rt_global_validate(void)
return ret;
}
-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)
{
@@ -2881,11 +2862,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.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups
2026-01-19 17:41 [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
` (2 preceding siblings ...)
2026-01-19 17:41 ` [PATCH 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
@ 2026-02-02 14:13 ` Michal Koutný
3 siblings, 0 replies; 6+ messages in thread
From: Michal Koutný @ 2026-02-02 14:13 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
On Mon, Jan 19, 2026 at 06:41:18PM +0100, Michal Koutný <mkoutny@suse.com> wrote:
> The crux is the first commit which fixes how sysctl
> kernel.sched_rt_runtime_us changes are validated with
> CONFIG_RT_GROUP_SCHED but rt_group_sched=0.
Ping please.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate()
2026-01-19 17:41 ` [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
@ 2026-02-11 7:57 ` K Prateek Nayak
0 siblings, 0 replies; 6+ messages in thread
From: K Prateek Nayak @ 2026-02-11 7:57 UTC (permalink / raw)
To: Michal Koutný,
Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider
Cc: linux-kernel
Hello Michal,
On 1/19/2026 11:11 PM, Michal Koutný wrote:
> 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 | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 2dfdf2d9471be..c621e61568359 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2810,15 +2810,7 @@ long sched_group_rt_period(struct task_group *tg)
> #ifdef CONFIG_SYSCTL
> static int sched_rt_global_constraints(void)
> {
> - int ret = 0;
A blank line after the definition would have been nice in the previous
patch but I suppose this is transient.
> - 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 */
>
> @@ -2850,7 +2842,16 @@ static int sched_rt_global_validate(void)
> NSEC_PER_USEC > max_rt_runtime)))
> return -EINVAL;
>
> - return 0;
> + int ret = 0;
I'm not a fan of the additional ifdeffry here but if we must, the "ret"
should either go at the beginning of the function, or you can get rid of
it entirely by ...
> +#ifdef CONFIG_RT_GROUP_SCHED
> + if (!rt_group_sched_enabled())
> + return ret;
... returning 0 directly here ...
> +
> + mutex_lock(&rt_constraints_mutex);
> + ret = __rt_schedulable(NULL, 0, 0);
... doing a
scoped_guard(mutex, &rt_constraints_mutex)
return __rt_schedulable(NULL, 0, 0);
here and ...
> + mutex_unlock(&rt_constraints_mutex);
> +#endif
> + return ret;
returning 0 directly here again.
> }
>
> static void sched_rt_do_global(void)
>
--
Thanks and Regards,
Prateek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-11 7:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-19 17:41 [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
2026-01-19 17:41 ` [PATCH 1/3] sched/rt: Skip group schedulable check with rt_group_sched=0 Michal Koutný
2026-01-19 17:41 ` [PATCH 2/3] sched/rt: Move group schedulability check to sched_rt_global_validate() Michal Koutný
2026-02-11 7:57 ` K Prateek Nayak
2026-01-19 17:41 ` [PATCH 3/3] sched/rt: Cleanup global RT bandwidth functions Michal Koutný
2026-02-02 14:13 ` [PATCH 0/3] sched/rt: Fix schedulable check with rt_group_sched=0 and cleanups Michal Koutný
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®