Re: [PATCH v6 1/4] sched/fair: Fix attaching task sched avgs twice when switching to fair or changing task group

From: Vincent Guittot
Date: Wed Jun 15 2016 - 10:15:57 EST


On 15 June 2016 at 02:18, Yuyang Du <yuyang.du@xxxxxxxxx> wrote:
> On Wed, Jun 15, 2016 at 09:46:53AM +0200, Vincent Guittot wrote:
>> I still have concerned with this change of the behavior that attaches
>> the task only when it is enqueued. The load avg of the task will not
>> be decayed between the time we move it into its new group until its
>> enqueue. With this change, a task's load can stay high whereas it has
>> slept for the last couple of seconds.
>
> The task will be updated when it is moved in the detach, so if it stays
> high, it is highly expected to be enqueued soon. But if the task is never

you can't do such assumption because if it's not enqueued soon (keep
in mind that a 10ms sleep will decay the value by 20% from max),
metrics become just wrong. Furthermore, the load metrics of the task
becomes different between a task being moved or the same task staying
on same cfs_rq.

> enqueued, we don't bother the new gruop cfs_rq.
>
> So this is not perfect, and nothing is perfect, but a simple solution.