sched/eevdf: Fix vruntime adjustment on reweight
authorAbel Wu <wuyun.abel@bytedance.com>
Tue, 7 Nov 2023 09:05:07 +0000 (17:05 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 14 Nov 2023 21:27:00 +0000 (22:27 +0100)
commiteab03c23c2a162085b13200d7942fc5a00b5ccc8
treee556a36c97807c03a50e95e625b8bb521c1a0474
parentb85ea95d086471afb4ad062012a4d73cd328fa86
sched/eevdf: Fix vruntime adjustment on reweight

vruntime of the (on_rq && !0-lag) entity needs to be adjusted when
it gets re-weighted, and the calculations can be simplified based
on the fact that re-weight won't change the w-average of all the
entities. Please check the proofs in comments.

But adjusting vruntime can also cause position change in RB-tree
hence require re-queue to fix up which might be costly. This might
be avoided by deferring adjustment to the time the entity actually
leaves tree (dequeue/pick), but that will negatively affect task
selection and probably not good enough either.

Fixes: 147f3efaa241 ("sched/fair: Implement an EEVDF-like scheduling policy")
Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231107090510.71322-2-wuyun.abel@bytedance.com
kernel/sched/fair.c