From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Daniel Hodges <hodgesd@meta.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.1] sched_ext: Reduce DSQ lock contention in consume_dispatch_q()
Date: Sat, 14 Mar 2026 22:58:05 -1000 [thread overview]
Message-ID: <abZ0nerzU1j19BEG@slm.duckdns.org> (raw)
In-Reply-To: <20260314235231.684671-1-arighi@nvidia.com>
Hello, Andrea.
On Sun, Mar 15, 2026 at 12:52:31AM +0100, Andrea Righi wrote:
...
> Benchmarks that generate many enqueue/dispatch events (e.g., schbench)
> show around 2-3x higher throughput with most of the scx schedulers with
> this change applied.
Can you share more details about the benchmark setup and results?
> + /*
> + * Use trylock to avoid spinning on a contended DSQ, if we fail to
> + * acquire the lock kick the CPU to retry on the next balance.
> + *
> + * In bypass mode simply spin to acquire the lock, since
> + * scx_kick_cpu() is suppressed.
> + */
> + if (scx_bypassing(sch, cpu)) {
> + raw_spin_lock(&dsq->lock);
> + } else if (!raw_spin_trylock(&dsq->lock)) {
> + scx_kick_cpu(sch, cpu, 0);
> + return false;
> + }
But I'm not sure this is what we wanna do. If we *really* want to do this,
maybe we can add a try_move variant; however, I'm pretty deeply skeptical
about the approach for a few reasons.
- If a shared DSQ becomes a bottleneck, the right thing to do would be
introducing multiple DSQs and shard them.
- This likely is trading off fairness to gain bandwidth and this approach
depending on machine / workload may lead to severe starvation. One can
argue that controlled trade off between fairness and bandwidth is useful
for some use cases. However, even if that is the case, I don't think
trylock is the way to get there. If we think that low overhead high
fan-out shared queue is desirable, it'd be better to introduce dedicated
data structure which can do so in a controlled manner.
Thakns.
--
tejun
next prev parent reply other threads:[~2026-03-15 8:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-14 23:52 Andrea Righi
2026-03-15 8:58 ` Tejun Heo [this message]
2026-03-15 9:40 ` Andrea Righi
2026-03-15 20:10 ` 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=abZ0nerzU1j19BEG@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=hodgesd@meta.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
all inboxes | Powered by JetHome®