]> git.baikalelectronics.ru Git - kernel.git/commit
sched/fair: Allow changing cgroup of new forked task
authorChengming Zhou <zhouchengming@bytedance.com>
Thu, 18 Aug 2022 12:48:03 +0000 (20:48 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 23 Aug 2022 09:01:19 +0000 (11:01 +0200)
commit8602f58d19e2aae5c82ffc94bee629a73a9d3112
tree91b3b04f50be7489b5d8c0ccca0abf4a3e79ced9
parentaa8961ada8a44c14d0b1f7199b6da30d03c8ba36
sched/fair: Allow changing cgroup of new forked task

commit 5240782debd4 ("sched/fair: Fix PELT integrity for new tasks")
introduce a TASK_NEW state and an unnessary limitation that would fail
when changing cgroup of new forked task.

Because at that time, we can't handle task_change_group_fair() for new
forked fair task which hasn't been woken up by wake_up_new_task(),
which will cause detach on an unattached task sched_avg problem.

This patch delete this unnessary limitation by adding check before do
detach or attach in task_change_group_fair().

So cpu_cgrp_subsys.can_attach() has nothing to do for fair tasks,
only define it in #ifdef CONFIG_RT_GROUP_SCHED.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20220818124805.601-8-zhouchengming@bytedance.com
kernel/sched/core.c
kernel/sched/fair.c