sched/fair: Add cfs_rq::avg_vruntime
authorPeter Zijlstra <peterz@infradead.org>
Wed, 31 May 2023 11:58:40 +0000 (13:58 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 19 Jul 2023 07:43:58 +0000 (09:43 +0200)
commitaf4cf40470c22efa3987200fd19478199e08e103
treeb11fe311e2c736bcfb73bc2b0d7ed3a86641056f
parent752182b24bf4ffda1c5a8025515d53122d930bd8
sched/fair: Add cfs_rq::avg_vruntime

In order to move to an eligibility based scheduling policy, we need
to have a better approximation of the ideal scheduler.

Specifically, for a virtual time weighted fair queueing based
scheduler the ideal scheduler will be the weighted average of the
individual virtual runtimes (math in the comment).

As such, compute the weighted average to approximate the ideal
scheduler -- note that the approximation is in the individual task
behaviour, which isn't strictly conformant.

Specifically consider adding a task with a vruntime left of center, in
this case the average will move backwards in time -- something the
ideal scheduler would of course never do.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230531124603.654144274@infradead.org
kernel/sched/debug.c
kernel/sched/fair.c
kernel/sched/sched.h