From: Chen Hui clare.chenhui@huawei.com
hulk inclusion category: bugfix bugzilla: 51828, https://gitee.com/openeuler/kernel/issues/I4K96G CVE: NA
--------------------------------
Remove residual checkings when move tasks to new task group or write new value to the cpu.qos_level cgroup file.
Signed-off-by: Chen Hui clare.chenhui@huawei.com Signed-off-by: Zheng Zucheng zhengzucheng@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- kernel/sched/core.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index e6f3f88d19d8b..1e8fca9b53d84 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6445,8 +6445,7 @@ static void sched_change_group(struct task_struct *tsk, int type) * No need to re-setcheduler when a task is exiting or the task * is in an autogroup. */ - if (!rt_task(tsk) - && !(tsk->flags & PF_EXITING) + if (!(tsk->flags & PF_EXITING) && !task_group_is_autogroup(tg)) { struct rq *rq = task_rq(tsk); struct sched_attr attr = { @@ -6455,12 +6454,9 @@ static void sched_change_group(struct task_struct *tsk, int type)
if (tg->qos_level == -1) { attr.sched_policy = SCHED_IDLE; - } else { - attr.sched_policy = SCHED_NORMAL; + attr.sched_nice = PRIO_TO_NICE(tsk->static_prio); + __setscheduler(rq, tsk, &attr, 0); } - attr.sched_nice = PRIO_TO_NICE(tsk->static_prio); - - __setscheduler(rq, tsk, &attr, 0); } #endif
@@ -6927,7 +6923,7 @@ static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css, #ifdef CONFIG_QOS_SCHED static int tg_change_scheduler(struct task_group *tg, void *data) { - int pid, policy; + int policy; struct css_task_iter it; struct sched_param param; struct task_struct *tsk; @@ -6945,12 +6941,8 @@ static int tg_change_scheduler(struct task_group *tg, void *data)
param.sched_priority = 0; css_task_iter_start(css, 0, &it); - while ((tsk = css_task_iter_next(&it))) { - pid = task_tgid_vnr(tsk); - - if (pid > 0 && !rt_task(tsk)) - sched_setscheduler(tsk, policy, ¶m); - } + while ((tsk = css_task_iter_next(&it))) + sched_setscheduler(tsk, policy, ¶m); css_task_iter_end(&it);
return 0;