[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyKUsBIXHu3NIcUb@slm.duckdns.org>
Date: Wed, 30 Oct 2024 10:18:56 -1000
From: Tejun Heo <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, David Vernet <void@...ifault.com>,
sched-ext@...a.com
Subject: Re: [RFC PATCH sched/urgent] sched: Task still delay-dequeued after
switched from fair
Hello,
On Wed, Oct 30, 2024 at 11:49:34AM +0100, Peter Zijlstra wrote:
...
> > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> > index 65334c13ffa5..601aad1a2625 100644
> > --- a/kernel/sched/ext.c
> > +++ b/kernel/sched/ext.c
> > @@ -5205,8 +5205,12 @@ static int scx_ops_enable(struct sched_ext_ops *ops, struct bpf_link *link)
> > while ((p = scx_task_iter_next_locked(&sti))) {
> > const struct sched_class *old_class = p->sched_class;
> > struct sched_enq_and_set_ctx ctx;
> > + int deq_flags = DEQUEUE_SAVE | DEQUEUE_MOVE;
> >
> > - sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);
> > + if (p->se.sched_delayed)
> > + deq_flags |= DEQUEUE_SLEEP | DEQUEUE_DELAYED;
> > +
> > + sched_deq_and_put_task(p, deq_flags, &ctx);
>
> I don't think this is quite right, the problem is that in this case
> ctx.queued is reporting true, even though you want it false.
>
> This is why 98442f0ccd82 ("sched: Fix delayed_dequeue vs switched_from_fair()")
> adds a second dequeue.
I see. Yeah, ctx.queued would be set incorrectly.
> Also, you seem to have a second instance of all that.
The disable path doesn't really need it because the transition direction is
always scx -> fair but yeah keeping the two loops in sync is fine too.
> Does the below work for you? I suppose I might as well go work on that
> TODO item now.
Yeap, it works. Will ack on the other thread.
Thanks.
--
tejun
Powered by blists - more mailing lists