Skip to content

Commit e34e013

Browse files
WerkovPeter Zijlstra
authored andcommitted
sched: Add commadline option for RT_GROUP_SCHED toggling
Only simple implementation with a static key wrapper, it will be wired in later. Signed-off-by: Michal Koutný <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a5a25b3 commit e34e013

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6280,6 +6280,11 @@
62806280
Memory area to be used by remote processor image,
62816281
managed by CMA.
62826282

6283+
rt_group_sched= [KNL] Enable or disable SCHED_RR/FIFO group scheduling
6284+
when CONFIG_RT_GROUP_SCHED=y. Defaults to
6285+
!CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED.
6286+
Format: <bool>
6287+
62836288
rw [KNL] Mount root device read-write on boot
62846289

62856290
S [KNL] Run init in single mode

init/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,17 @@ config RT_GROUP_SCHED
10821082
realtime bandwidth for them.
10831083
See Documentation/scheduler/sched-rt-group.rst for more information.
10841084

1085+
config RT_GROUP_SCHED_DEFAULT_DISABLED
1086+
bool "Require boot parameter to enable group scheduling for SCHED_RR/FIFO"
1087+
depends on RT_GROUP_SCHED
1088+
default n
1089+
help
1090+
When set, the RT group scheduling is disabled by default. The option
1091+
is in inverted form so that mere RT_GROUP_SCHED enables the group
1092+
scheduling.
1093+
1094+
Say N if unsure.
1095+
10851096
config EXT_GROUP_SCHED
10861097
bool
10871098
depends on SCHED_CLASS_EXT && CGROUP_SCHED

kernel/sched/core.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9892,6 +9892,31 @@ static struct cftype cpu_legacy_files[] = {
98929892
{ } /* Terminate */
98939893
};
98949894

9895+
#ifdef CONFIG_RT_GROUP_SCHED
9896+
# ifdef CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED
9897+
DEFINE_STATIC_KEY_FALSE(rt_group_sched);
9898+
# else
9899+
DEFINE_STATIC_KEY_TRUE(rt_group_sched);
9900+
# endif
9901+
9902+
static int __init setup_rt_group_sched(char *str)
9903+
{
9904+
long val;
9905+
9906+
if (kstrtol(str, 0, &val) || val < 0 || val > 1) {
9907+
pr_warn("Unable to set rt_group_sched\n");
9908+
return 1;
9909+
}
9910+
if (val)
9911+
static_branch_enable(&rt_group_sched);
9912+
else
9913+
static_branch_disable(&rt_group_sched);
9914+
9915+
return 1;
9916+
}
9917+
__setup("rt_group_sched=", setup_rt_group_sched);
9918+
#endif /* CONFIG_RT_GROUP_SCHED */
9919+
98959920
static int cpu_extra_stat_show(struct seq_file *sf,
98969921
struct cgroup_subsys_state *css)
98979922
{

kernel/sched/sched.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,23 @@ static inline bool sched_group_cookie_match(struct rq *rq,
15001500
}
15011501

15021502
#endif /* !CONFIG_SCHED_CORE */
1503+
#ifdef CONFIG_RT_GROUP_SCHED
1504+
# ifdef CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED
1505+
DECLARE_STATIC_KEY_FALSE(rt_group_sched);
1506+
static inline bool rt_group_sched_enabled(void)
1507+
{
1508+
return static_branch_unlikely(&rt_group_sched);
1509+
}
1510+
# else
1511+
DECLARE_STATIC_KEY_TRUE(rt_group_sched);
1512+
static inline bool rt_group_sched_enabled(void)
1513+
{
1514+
return static_branch_likely(&rt_group_sched);
1515+
}
1516+
# endif /* CONFIG_RT_GROUP_SCHED_DEFAULT_DISABLED */
1517+
#else
1518+
# define rt_group_sched_enabled() false
1519+
#endif /* CONFIG_RT_GROUP_SCHED */
15031520

15041521
static inline void lockdep_assert_rq_held(struct rq *rq)
15051522
{

0 commit comments

Comments
 (0)