Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: Introduce CONFIG_GROUP_SCHED_WEIGHT

sched_ext will soon add cgroup cpu.weigh support. The cgroup interface code
is currently gated behind CONFIG_FAIR_GROUP_SCHED. As the fair class and/or
SCX may implement the feature, put the interface code behind the new
CONFIG_CGROUP_SCHED_WEIGHT which is selected by CONFIG_FAIR_GROUP_SCHED.
This allows either sched class to enable the itnerface code without ading
more complex CONFIG tests.

When !CONFIG_FAIR_GROUP_SCHED, a dummy version of sched_group_set_shares()
is added to support later CONFIG_CGROUP_SCHED_WEIGHT &&
!CONFIG_FAIR_GROUP_SCHED builds.

No functional changes.

Signed-off-by: Tejun Heo <tj@kernel.org>

+14 -8
+4
init/Kconfig
··· 1024 1024 tasks. 1025 1025 1026 1026 if CGROUP_SCHED 1027 + config GROUP_SCHED_WEIGHT 1028 + def_bool n 1029 + 1027 1030 config FAIR_GROUP_SCHED 1028 1031 bool "Group scheduling for SCHED_OTHER" 1029 1032 depends on CGROUP_SCHED 1033 + select GROUP_SCHED_WEIGHT 1030 1034 default CGROUP_SCHED 1031 1035 1032 1036 config CFS_BANDWIDTH
+7 -7
kernel/sched/core.c
··· 9193 9193 } 9194 9194 #endif /* CONFIG_UCLAMP_TASK_GROUP */ 9195 9195 9196 - #ifdef CONFIG_FAIR_GROUP_SCHED 9196 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 9197 9197 static unsigned long tg_weight(struct task_group *tg) 9198 9198 { 9199 9199 return scale_load_down(tg->shares); ··· 9212 9212 { 9213 9213 return tg_weight(css_tg(css)); 9214 9214 } 9215 + #endif /* CONFIG_GROUP_SCHED_WEIGHT */ 9215 9216 9216 9217 #ifdef CONFIG_CFS_BANDWIDTH 9217 9218 static DEFINE_MUTEX(cfs_constraints_mutex); ··· 9558 9557 return 0; 9559 9558 } 9560 9559 #endif /* CONFIG_CFS_BANDWIDTH */ 9561 - #endif /* CONFIG_FAIR_GROUP_SCHED */ 9562 9560 9563 9561 #ifdef CONFIG_RT_GROUP_SCHED 9564 9562 static int cpu_rt_runtime_write(struct cgroup_subsys_state *css, ··· 9585 9585 } 9586 9586 #endif /* CONFIG_RT_GROUP_SCHED */ 9587 9587 9588 - #ifdef CONFIG_FAIR_GROUP_SCHED 9588 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 9589 9589 static s64 cpu_idle_read_s64(struct cgroup_subsys_state *css, 9590 9590 struct cftype *cft) 9591 9591 { ··· 9600 9600 #endif 9601 9601 9602 9602 static struct cftype cpu_legacy_files[] = { 9603 - #ifdef CONFIG_FAIR_GROUP_SCHED 9603 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 9604 9604 { 9605 9605 .name = "shares", 9606 9606 .read_u64 = cpu_shares_read_u64, ··· 9710 9710 return 0; 9711 9711 } 9712 9712 9713 - #ifdef CONFIG_FAIR_GROUP_SCHED 9713 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 9714 9714 9715 9715 static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css, 9716 9716 struct cftype *cft) ··· 9764 9764 9765 9765 return sched_group_set_shares(css_tg(css), scale_load(weight)); 9766 9766 } 9767 - #endif 9767 + #endif /* CONFIG_GROUP_SCHED_WEIGHT */ 9768 9768 9769 9769 static void __maybe_unused cpu_period_quota_print(struct seq_file *sf, 9770 9770 long period, long quota) ··· 9824 9824 #endif 9825 9825 9826 9826 static struct cftype cpu_files[] = { 9827 - #ifdef CONFIG_FAIR_GROUP_SCHED 9827 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 9828 9828 { 9829 9829 .name = "weight", 9830 9830 .flags = CFTYPE_NOT_ON_ROOT,
+3 -1
kernel/sched/sched.h
··· 483 483 484 484 }; 485 485 486 - #ifdef CONFIG_FAIR_GROUP_SCHED 486 + #ifdef CONFIG_GROUP_SCHED_WEIGHT 487 487 #define ROOT_TASK_GROUP_LOAD NICE_0_LOAD 488 488 489 489 /* ··· 575 575 static inline void set_task_rq_fair(struct sched_entity *se, 576 576 struct cfs_rq *prev, struct cfs_rq *next) { } 577 577 #endif /* CONFIG_SMP */ 578 + #else /* !CONFIG_FAIR_GROUP_SCHED */ 579 + static inline int sched_group_set_shares(struct task_group *tg, unsigned long shares) { return 0; } 578 580 #endif /* CONFIG_FAIR_GROUP_SCHED */ 579 581 580 582 #else /* CONFIG_CGROUP_SCHED */