Re: [RFC][PATCH 08/10] sched/fair: Implement delayed dequeue

From: Peter Zijlstra
Date: Thu Apr 25 2024 - 06:25:38 EST


On Thu, Apr 11, 2024 at 09:32:23AM +0800, Yan-Jie Wang wrote:
> I have an alternative approach to delayed-dequeue inspired by the original
> CFS implementation.
>
> The idea is to keep the task's vruntime when it goes to sleep.
> When the task is woken up, see if the lag is positive at the woken time, if
> it is the case, clamp it to 0 by setting vruntime to avg_vruntime().

Problem is that avg_vruntime() can go backwards, eg by dequeueing a
negative lag task. This gets really hard to argue about real quick.

Keeping the task competing (delaying the dequeue) is by far the simplest
solution -- conceptually.

The code just became a total mess because of cgroups :/