[PATCH v2 5/7] sched: Limit sysctl sched_rt_{period|runtime}_us to RT_GROUP_SCHED
From: Sebastian Andrzej Siewior
Date: Tue Nov 10 2026 - 12:46:40 EST
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@xxxxxxxxxxxxx>
---
kernel/sched/rt.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1a6450f91d567..855e4ee470f69 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -25,11 +25,22 @@ int sysctl_sched_rt_runtime = 1000000;
#ifdef CONFIG_SYSCTL
static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ;
-static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
- size_t *lenp, loff_t *ppos);
static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos);
static const struct ctl_table sched_rt_sysctls[] = {
+ {
+ .procname = "sched_rr_timeslice_ms",
+ .data = &sysctl_sched_rr_timeslice,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = sched_rr_handler,
+ },
+};
+
+#ifdef CONFIG_RT_GROUP_SCHED
+static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos);
+static const struct ctl_table sched_rt_group_sysctls[] = {
{
.procname = "sched_rt_period_us",
.data = &sysctl_sched_rt_period,
@@ -48,18 +59,15 @@ static const struct ctl_table sched_rt_sysctls[] = {
.extra1 = SYSCTL_NEG_ONE,
.extra2 = (void *)&sysctl_sched_rt_period,
},
- {
- .procname = "sched_rr_timeslice_ms",
- .data = &sysctl_sched_rr_timeslice,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = sched_rr_handler,
- },
};
+#endif
static int __init sched_rt_sysctl_init(void)
{
register_sysctl_init("kernel", sched_rt_sysctls);
+#ifdef CONFIG_RT_GROUP_SCHED
+ register_sysctl_init("kernel", sched_rt_group_sysctls);
+#endif
return 0;
}
late_initcall(sched_rt_sysctl_init);
@@ -2845,6 +2853,7 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
#endif /* !CONFIG_RT_GROUP_SCHED */
#ifdef CONFIG_SYSCTL
+#ifdef CONFIG_RT_GROUP_SCHED
static int sched_rt_global_validate(void)
{
if ((sysctl_sched_rt_runtime != RUNTIME_INF) &&
@@ -2853,13 +2862,11 @@ 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;
}
@@ -2887,6 +2894,7 @@ static int sched_rt_handler(const struct ctl_table *table, int write, void *buff
return ret;
}
+#endif /* !CONFIG_RT_GROUP_SCHED */
static int sched_rr_handler(const struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos)
--
2.55.0