mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, David Vernet <void@manifault.com>,
	sched-ext@meta.com
Subject: Re: [RFC PATCH sched/urgent] sched: Task still delay-dequeued after switched from fair
Date: Wed, 30 Oct 2024 10:18:56 -1000	[thread overview]
Message-ID: <ZyKUsBIXHu3NIcUb@slm.duckdns.org> (raw)
In-Reply-To: <20241030104934.GK14555@noisy.programming.kicks-ass.net>

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

  reply	other threads:[~2024-10-30 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30  0:07 Tejun Heo
2024-10-30 10:49 ` Peter Zijlstra
2024-10-30 20:18   ` Tejun Heo [this message]
2024-10-31 15:40   ` [tip: sched/urgent] sched/ext: Fix scx vs sched_delayed tip-bot2 for Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyKUsBIXHu3NIcUb@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=sched-ext@meta.com \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®