From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
sched-ext@lists.linux.dev, Emil Tsalapatis <emil@etsalapatis.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.1-fixes] sched_ext: Fix deadlock between scx_root_disable() and concurrent forks
Date: Sun, 17 May 2026 07:25:09 -1000 [thread overview]
Message-ID: <agn59c826ofPPA5g@slm.duckdns.org> (raw)
In-Reply-To: <agme4i4w5K6Ab9cM@gpd4>
Hello,
On Sun, May 17, 2026 at 12:56:34PM +0200, Andrea Righi wrote:
> > + * Must come after scx_switching_all test. While both are set, we must
> > + * return true via the branch above: [__]scx_switching_all are cleared
> > + * together under scx_enable_mutex, and a fork routed to fair while
> > + * __scx_switched_all is still on would stall because
> > + * next_active_class() skips fair.
>
> Just being extra picky: [__]scx_switching_all are cleared together sequentially,
> but not atomically (in fact the order is what matters). To make it more clear,
> how about rephrasing the comment block above like this:
>
> * Must come after the scx_switching_all test. scx_root_disable()
> * clears __scx_switched_all before scx_switching_all (both under
> * scx_enable_mutex), so while scx_switching_all is observed as true,
> * __scx_switched_all may still be on. A fork routed to fair in that
> * window would stall because next_active_class() skips fair.
Hmm... I don't think the ordering between scx_switching_all and
__scx_switching_all matters here. The stall is caused by the gap between the
earlier DISABLING transition and __scx_switching_all being turned off which
here is tested through scx_switching_all and at this point as the mutex is
already held, even if you swapped scx_switching_all's position with
__scx_switching_all, it wouldn't matter. It's just kinda confusing because
what's actually involved in the stall and deadlock is __scx_switching_all
but we're testing it via scx_switching_all. I'll update the comment so that
it just mentions __scx_switching_all. I'm not even sure we actually need
scx_switching_all.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-05-17 17:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 0:41 [PATCH sched_ext/for-7.1-fixes] sched_ext: Fix deadlock between scx_root_disable() and concurrent forks Tejun Heo
2026-05-17 10:56 ` Andrea Righi
2026-05-17 17:25 ` Tejun Heo [this message]
2026-05-17 17:43 ` [PATCH v2 " Tejun Heo
2026-05-17 18:47 ` Andrea Righi
2026-05-17 19:08 ` Tejun Heo
2026-05-17 19:15 ` Tejun Heo
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=agn59c826ofPPA5g@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.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