Re: [PATCH v3] sched/fair: remove dead code on enqueue_task_fair()

From: Peter Zijlstra

Date: Thu Oct 15 2026 - 03:50:57 EST


On Thu, Oct 15, 2026 at 10:42:38AM +0300, Kayra Cizmeci wrote:
> > > I'm not entirely sure I follow. With the above fix there is still only
> > > one place_entity(), which is after enqueue_hierarchy() and has
> > > ENQUEUE_QUEUED on.
>
> > Exactly.
>
> > >
> > > Here enqueue_hierarchy() adds the entity to h_nr_queued, and
> > > ENQUEUE_QUEUED tells place_entity() exactly this, so it can adjust.
>
> > ... but place_entity(ENQUEUE_QUEUED) still does:
> >
> > load = cfs_rq->sum_weight;
> > if (curr && curr->on_rq) // <-- this is true after enqueue_hierarchy()
> > load += avg_vruntime_weight(cfs_rq, curr->h_load.weight);
> >
> > weight = avg_vruntime_weight(cfs_rq, se->h_load.weight); // <- this assumes se isn't already part of cfs_rq weight, but it is (still)
> > lag *= load + weight;
> > ...
>
> > (in this concrete enqueue()->dequeue() due to unthrottling case)
>
> Fixing this requiers bit of a revert I think. Or something really close to a revert.
>
> Peter/Christian, would you be OK if I send a fix about this with a revert
> (that I caused :<) and a comment or one of you guys want to fix it your way?
> And is there any cleaner way to fix these without a revert?

I'm not seeing one at the moment; that is, I end up making it a bigger
mess. Feel free to send a revert that includes a comment about this.