Re: [PATCH v2 1/7] sched/fair: Fix zero_vruntime tracking
From: Peter Zijlstra
Date: Tue Feb 24 2026 - 04:06:42 EST
On Tue, Feb 24, 2026 at 09:53:06AM +0100, Dietmar Eggemann wrote:
> On 23.02.26 15:15, Peter Zijlstra wrote:
> > On Mon, Feb 23, 2026 at 02:09:52PM +0100, Dietmar Eggemann wrote:
> >> On 19.02.26 08:58, Peter Zijlstra wrote:
> >>> It turns out that zero_vruntime tracking is broken when there is but a single
> >>> task running. Current update paths are through __{en,de}queue_entity(), and
> >>> when there is but a single task, pick_next_task() will always return that one
> >>> task, and put_prev_set_next_task() will end up in neither function.
> >>
> >> Tried hard but I don't get the last clause.
> >
> > When prev==next, then put_prev_set_next_task() bails out and we'll never
> > hit __enqueue_entity()/__dequeue_entity().
>
> Ah, I see. But IMHO put_prev_set_next_task() is never called for the
> testcase below (CPU hog is prev and next in put_prev_set_next_task())
>
> But (prev != p) in pick_next_task_fair() is avoided ?
>
> pick_next_task_fair()
>
> if (prev != p) {
>
> while (!is_same_group())
> put_prev_entity()
> set_next_entity()
>
> put_prev_entity()
> set_next_entity()
> }
>
Ah yes, pick_next_task_fair() open codes that. Also, I might have a
patch to 'fix' all that, but I've not goten around to posting that.
There's still a few wobblies in that part of the pile :/
Look at the top 3 patches in queue/sched/flat if you're up for it :-)