sched/fair: Remove redundant cpu_cgrp_subsys->fork()
authorChengming Zhou <zhouchengming@bytedance.com>
Thu, 18 Aug 2022 12:47:58 +0000 (20:47 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 23 Aug 2022 09:01:17 +0000 (11:01 +0200)
commit39c4261191bf05e7eb310f852980a6d0afe5582a
treee9ab63aedb6a7ebeff13416bccdb243a5649c0d3
parent78b6b15770618efb60d84e2d605f6b93dc94051b
sched/fair: Remove redundant cpu_cgrp_subsys->fork()

We use cpu_cgrp_subsys->fork() to set task group for the new fair task
in cgroup_post_fork().

Since commit b1e8206582f9 ("sched: Fix yet more sched_fork() races")
has already set_task_rq() for the new fair task in sched_cgroup_fork(),
so cpu_cgrp_subsys->fork() can be removed.

  cgroup_can_fork() --> pin parent's sched_task_group
  sched_cgroup_fork()
    __set_task_cpu()
      set_task_rq()
  cgroup_post_fork()
    ss->fork() := cpu_cgroup_fork()
      sched_change_group(..., TASK_SET_GROUP)
        task_set_group_fair()
          set_task_rq()  --> can be removed

After this patch's change, task_change_group_fair() only need to
care about task cgroup migration, make the code much simplier.

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>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lore.kernel.org/r/20220818124805.601-3-zhouchengming@bytedance.com
kernel/sched/core.c
kernel/sched/fair.c
kernel/sched/sched.h