]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched: Add commadline option for RT_GROUP_SCHED toggling
authorMichal Koutný <mkoutny@suse.com>
Mon, 10 Mar 2025 17:04:36 +0000 (18:04 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 8 Apr 2025 18:55:53 +0000 (20:55 +0200)
Only simple implementation with a static key wrapper, it will be wired
in later.

Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250310170442.504716-5-mkoutny@suse.com
Documentation/admin-guide/kernel-parameters.txt
init/Kconfig
kernel/sched/core.c
kernel/sched/sched.h

index 3f35d5b8c29647b7984ff3318c1d1ec84581d2be..168202330cfafd1c38bd4606cc474297c092d1a8 100644 (file)
                        Memory area to be used by remote processor image,
                        managed by CMA.
 
+       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
index 681f38ee68db2317c3d90d92ad92d7991ea0f676..b2c045c71d7f57e4c27b60f4bc72312d9cc5ca9c 100644 (file)
@@ -1082,6 +1082,17 @@ config RT_GROUP_SCHED
          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
index 042c978f7c9bf3d70d371b5ac2773bdadc134311..58d093a8c1af7b795b9a03099ff64ac4e71516f9 100644 (file)
@@ -9892,6 +9892,31 @@ static struct cftype cpu_legacy_files[] = {
        { }     /* Terminate */
 };
 
+#ifdef CONFIG_RT_GROUP_SCHED
+# ifdef CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED
+DEFINE_STATIC_KEY_FALSE(rt_group_sched);
+# else
+DEFINE_STATIC_KEY_TRUE(rt_group_sched);
+# endif
+
+static int __init setup_rt_group_sched(char *str)
+{
+       long val;
+
+       if (kstrtol(str, 0, &val) || val < 0 || val > 1) {
+               pr_warn("Unable to set rt_group_sched\n");
+               return 1;
+       }
+       if (val)
+               static_branch_enable(&rt_group_sched);
+       else
+               static_branch_disable(&rt_group_sched);
+
+       return 1;
+}
+__setup("rt_group_sched=", setup_rt_group_sched);
+#endif /* CONFIG_RT_GROUP_SCHED */
+
 static int cpu_extra_stat_show(struct seq_file *sf,
                               struct cgroup_subsys_state *css)
 {
index c006348102d9b9d1123b989d232ac81fdf4364fd..d1e591f91cf8a4b3abf1a0f82079909010d0c836 100644 (file)
@@ -1500,6 +1500,23 @@ static inline bool sched_group_cookie_match(struct rq *rq,
 }
 
 #endif /* !CONFIG_SCHED_CORE */
+#ifdef CONFIG_RT_GROUP_SCHED
+# ifdef CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED
+DECLARE_STATIC_KEY_FALSE(rt_group_sched);
+static inline bool rt_group_sched_enabled(void)
+{
+       return static_branch_unlikely(&rt_group_sched);
+}
+# else
+DECLARE_STATIC_KEY_TRUE(rt_group_sched);
+static inline bool rt_group_sched_enabled(void)
+{
+       return static_branch_likely(&rt_group_sched);
+}
+# endif /* CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED */
+#else
+# define rt_group_sched_enabled()      false
+#endif /* CONFIG_RT_GROUP_SCHED */
 
 static inline void lockdep_assert_rq_held(struct rq *rq)
 {