Sched_ext development
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kuba Piecuch <jpiecuch@google.com>
Cc: David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	fangqiurong <fangqiurong@kylinos.cn>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] sched_ext: Fix ops_state and ops.dequeue() locking races in dispatch
Date: Tue, 24 Nov 2026 14:18:56 -1000	[thread overview]
Message-ID: <d0843faaef949300df9b51a09e36a696@kernel.org> (raw)
In-Reply-To: <20261123170846.3165648-2-jpiecuch@google.com>

Hello, Kuba.

On Mon, Nov 23, 2026 at 05:10:32PM +0000, Kuba Piecuch wrote:
> @@ -1871,8 +1884,10 @@ static void scx_dispatch_enqueue(struct scx_sched *sch, struct rq *rq,
>
>  		if (unlikely(dsq->id == SCX_DSQ_INVALID)) {
>  			scx_error(sch, "attempting to dispatch to a destroyed dsq");
> -			/* fall back to the global dsq */
>  			raw_spin_unlock(&dsq->lock);
> +			if (rq != task_rq(p))
> +				return false;
> +			/* fall back to the global dsq */
>  			dsq = find_global_dsq(sch, task_cpu(p));
>  			raw_spin_lock(&dsq->lock);

I don't think the task needs to go to the global DSQ here. The scheduler
is being ejected at this point and bypass is going to cycle all its
runnable tasks. Maybe we can just let go of the task and return, for both
the local and remote cases, and let the abort path recover it? What the
BPF scheduler sees after scx_error() doesn't matter as long as the
scheduler can be ejected and all the tasks are recovered. That'd get rid
of the bool return and the retry in finish_dispatch().

Also, can you please factor out release_dispatching_and_lock_task_rq()
from dispatch_to_local_dsq() in a separate prep patch?

The approach looks good to me otherwise. Can you please send v2 with the
above updated?

Thanks.

--
tejun

  reply	other threads:[~2026-11-25  0:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:10 [PATCHSET sched_ext/for-7.4-fixes] sched_ext: Fix ops_state and ops.dequeue() locking in dispatch Kuba Piecuch
2026-11-23 17:10 ` [PATCH 1/3] sched_ext: Fix ops_state and ops.dequeue() locking races " Kuba Piecuch
2026-11-25  0:18   ` Tejun Heo [this message]
2026-11-23 17:10 ` [PATCH 2/3] sched_ext: Remove scx_wait_dispatching() Kuba Piecuch
2026-11-23 17:10 ` [PATCH 3/3] selftests/sched_ext: Test that ops.dequeue() runs with the task's rq locked Kuba Piecuch

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=d0843faaef949300df9b51a09e36a696@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=fangqiurong@kylinos.cn \
    --cc=jpiecuch@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --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