sched/fair: Increase PELT accuracy for small tasks
authorPeter Zijlstra <peterz@infradead.org>
Mon, 10 Apr 2017 11:20:45 +0000 (13:20 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 14 Apr 2017 08:26:36 +0000 (10:26 +0200)
We truncate (and loose) the lower 10 bits of runtime in
___update_load_avg(), this means there's a consistent bias to
under-account tasks. This is esp. significant for small tasks.

Cure this by only forwarding last_update_time to the point we've
actually accounted for, leaving the remainder for the next time.

Reported-by: Morten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index d43e9ac9c3c5ab64aeb3cd45c5694b9842904a43..1e3b99a9ab69ff5b47fc903a2335153b74db4aa5 100644 (file)
@@ -2915,7 +2915,8 @@ ___update_load_avg(u64 now, int cpu, struct sched_avg *sa,
        delta >>= 10;
        if (!delta)
                return 0;
-       sa->last_update_time = now;
+
+       sa->last_update_time += delta << 10;
 
        /*
         * Now we know we crossed measurement unit boundaries. The *_avg