From: Tejun Heo <tj@kernel.org>
To: David Vernet <void@manifault.com>
Cc: sched-ext@meta.com, kernel-team@meta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scx: Fix raciness in scx_ops_bypass()
Date: Fri, 25 Oct 2024 10:43:53 -1000 [thread overview]
Message-ID: <ZxwDCUcyTABN8Exj@slm.duckdns.org> (raw)
In-Reply-To: <20241025203929.22839-1-void@manifault.com>
Hello,
This looks great overall. One nit below.
On Fri, Oct 25, 2024 at 03:39:29PM -0500, David Vernet wrote:
...
> static void scx_ops_bypass(bool bypass)
> {
> - int depth, cpu;
> + int cpu;
> + unsigned long flags;
>
> + raw_spin_lock_irqsave(&__scx_ops_bypass_lock, flags);
> if (bypass) {
> - depth = atomic_inc_return(&scx_ops_bypass_depth);
> - WARN_ON_ONCE(depth <= 0);
> - if (depth != 1)
> - return;
> + scx_ops_bypass_depth++;
> + WARN_ON_ONCE(scx_ops_bypass_depth <= 0);
> + if (scx_ops_bypass_depth != 1)
> + goto unlock;
> } else {
> - depth = atomic_dec_return(&scx_ops_bypass_depth);
> - WARN_ON_ONCE(depth < 0);
> - if (depth != 0)
> - return;
> + scx_ops_bypass_depth--;
> + WARN_ON_ONCE(scx_ops_bypass_depth < 0);
> + if (scx_ops_bypass_depth != 0)
> + goto unlock;
Now that we know irq is disabled in the body, can you also please change
rq_lock_irqsave() to rq_lock?
Thanks.
--
tejun
next prev parent reply other threads:[~2024-10-25 20:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 20:39 David Vernet
2024-10-25 20:43 ` Tejun Heo [this message]
2024-10-25 20:48 ` David Vernet
2024-10-25 20:54 ` [PATCH v3] " David Vernet
2024-10-25 21:12 ` 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=ZxwDCUcyTABN8Exj@slm.duckdns.org \
--to=tj@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.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®