Re: [PATCH v2 2/3] sched/fair: Skip detach and attach new group task

From: Peter Zijlstra
Date: Tue May 31 2016 - 08:40:10 EST


On Tue, May 31, 2016 at 02:33:45PM +0200, Vincent Guittot wrote:

> The sched_avg of a task is not used anymore in copy_process with
> yuyang's patchset. To be fully correct, we still have a
> p->se.avg.last_update_time = 0 in cpu_cgroup_fork but this is just the
> side effect of factoring cpu_group_fork and cpu_group_move in
> sched_move_task and it will be overwritten by
> init_entity_runnable_average before being used.

Yeah, but why? Why does init_entity_runnable_average() live in
wake_up_new_task()? That doesn't seem to make sense.

Also note that vruntime_normalized() (ab)uses !se->sum_exec_runtime to
detect the new task state.

> Now, cpu_cgroup_fork() only sets task group and cfs_rq of the forked task
>
> copy_process
> sched_fork
> ...
> cgroup_post_fork
> ss->fork() := cpu_cgroup_fork() which only set task group and
> cfs_rq of the sched_entity of the task
>
> wake_up_new_task
> init_entity_runnable_average
> activate_task
> enqueue_task
> attach_task