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

Peter Zijlstra
2024-04-26T11:16:20Z

On Fri, Apr 26, 2024 at 12:56:07PM +0200, Peter Zijlstra wrote:
> On Thu, Apr 25, 2024 at 01:28:55PM +0200, Peter Zijlstra wrote:
> > On Thu, Apr 18, 2024 at 06:24:59PM +0200, Mike Galbraith wrote:
> > > The root cause seems to be doing the delay dequeue business on
> > > exiting tasks.
> >
> > > ---
> > > kernel/sched/fair.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -5374,6 +5374,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
> > > update_curr(cfs_rq);
> > >
> > > if (sched_feat(DELAY_DEQUEUE) && sleep &&
> > > + !(entity_is_task(se) && (task_of(se)->flags & PF_EXITING)) &&
> > > !entity_eligible(cfs_rq, se)) {
> > > if (cfs_rq->next == se)
> > > cfs_rq->next = NULL;
> >
> > So I think this can be easier done in dequeue_task_fair(), where we
> > still know this is a task.
> >
> > Perhaps something like (I'll test later):
> >
> > if (p->flags & PF_EXITING)
> > flags &= ~DEQUEUE_SLEEP;
> >
> > But now I need to go think about the case of removing a cgroup...
> > *urgh*.
>
> I ended up with the below instead; lemme go run this unixbench spawn on it.

Seems to survive that.

I pushed out the patches with updates to queue/sched/eevdf