hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IAQWPQ
-----------------------------------------
We add a new parameter group_steal in cmdline to enable the steal task feature for cgroup. That is, when group_steal is not configured in cmdline, it means the feature is enabled globally; after configuration, it can be enabled only for a certain cgroup.
Signed-off-by: Cheng Yu serein.chengyu@huawei.com --- kernel/sched/fair.c | 8 ++++++++ kernel/sched/sched.h | 9 +++++++++ 2 files changed, 17 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 45b8e13943db..5b737961e327 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,6 +4446,14 @@ static inline void rq_idle_stamp_clear(struct rq *rq) }
#ifdef CONFIG_SCHED_STEAL +DEFINE_STATIC_KEY_FALSE(group_steal); + +static int __init group_steal_setup(char *__unused) +{ + static_branch_enable(&group_steal); + return 1; +} +__setup("group_steal", group_steal_setup);
static inline bool steal_enabled(void) { diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index a6d7febf789d..87c63fa5625e 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1778,6 +1778,15 @@ extern void set_sched_cluster(void); static inline void set_sched_cluster(void) { } #endif
+#ifdef CONFIG_SCHED_STEAL +DECLARE_STATIC_KEY_FALSE(group_steal); + +static inline bool group_steal_used(void) +{ + return static_branch_unlikely(&group_steal); +} +#endif + #ifdef CONFIG_NUMA #ifdef CONFIG_SCHED_STEAL extern struct static_key_true sched_steal_allow;