Re: [PATCH 3/4] sched/eevdf: O(1) fastpath for task selection

From: Peter Zijlstra
Date: Tue Nov 07 2023 - 05:42:54 EST


On Tue, Nov 07, 2023 at 06:12:49PM +0800, Abel Wu wrote:

> > @@ -904,7 +905,7 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
> > * in this cfs_rq, saving some cycles.
> > */
> > if (cfs_rq->nr_running == 1)
> > - return curr && curr->on_rq ? curr : __node_2_se(node);
> > + return curr && curr->on_rq ? curr : se;
>
> Maybe we can reduce memory footprint on curr by:
>
> return se ? se : curr;

Irrespective, I think that logic makes more sense. If we know we have
but one task and the tree has a task, it must be that task, otherwise,
current must be it.

Anyway, I was still staring at the previous patch, flipping the tree
around like that is clever. Yes I suppose that ought to work just fine.