Re: [PATCH v3 10/13] sched/fair: Compute task/cpu utilization at wake-up more correctly

From: Morten Rasmussen
Date: Mon Aug 15 2016 - 11:42:57 EST


On Mon, Aug 15, 2016 at 04:23:42PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 25, 2016 at 02:34:27PM +0100, Morten Rasmussen wrote:
> > To solve this problem, this patch introduces task_util_wake() which
> > computes the decayed task utilization based on the last update of the
> > previous cpu's last load-tracking update. It is done without having to
> > take the rq lock, similar to how it is done in remove_entity_load_avg().
>
> But unlike that function, it doesn't actually use __update_load_avg().
> Why not?

Fair question :)

We currently exploit the fact that the task utilization is _not_ updated
in wake-up balancing to make sure we don't under-estimate the capacity
requirements for tasks that have slept for a while. If we update it, we
loose the non-decayed 'peak' utilization, but I guess we could just
store it somewhere when we do the wake-up decay.

I thought there was a better reason when I wrote the patch, but I don't
recall right now. I will look into it again and see if we can use
__update_load_avg() to do a proper update instead of doing things twice.