From: Tejun Heo <tj@kernel.org>
To: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Tvrtko Ursulin via Kernel-dev <kernel-dev@igalia.com>,
dri-devel@lists.freedesktop.org,
Boris Brezillon <boris.brezillon@collabora.com>,
Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>, Chia-I Wu <olvaffe@gmail.com>,
Matthew Brost <matthew.brost@intel.com>,
linux-kernel@vger.kernel.org, Chia-I Wu <olv@google.com>
Subject: Re: [RFC v3 1/2] workqueue: Add support for real-time workers
Date: Wed, 22 Jul 2026 09:05:30 -1000 [thread overview]
Message-ID: <amEUelR4oL_odDuq@slm.duckdns.org> (raw)
In-Reply-To: <8dffe078-ca2e-4d01-96b3-f1709472ef1b@igalia.com>
Hello, sorry about the delay.
On Fri, Jul 17, 2026 at 11:06:55AM +0100, Tvrtko Ursulin wrote:
> > + /*
> > + * Do not consume all CPUs with RT workers to avoid scheduler
> > + * starvation.
> > + */
> > + if (pool->attrs->prio == WQ_PRIO_RT) {
> > + unsigned int max = num_online_cpus();
> > +
> > + if (max > 2)
> > + max = max - 1;
> > + else
> > + max = 1;
> > +
> > + if (atomic_inc_return(&total_rtpri_workers) > max) {
> > + atomic_dec(&total_rtpri_workers);
> > + return NULL;
>
> Sashiko is warning me here this can create a deadlock when called from
> maybe_create_worker(). My apparently naive idea was that this would make it
> wait for a bit, until the load on the currently instantiated workers
> subsides, at which point need_to_create_worker() would say "not any more"
> and allow it to exit.
>
> But even more importantly, it is also warning me that strict CPU affinity
> creates per CPU threads.
>
> So my idea of global limit will just not work.
>
> Tejun, how does this sound to you? Are you okay without having the global
> limit of RT threads?
>
> I will await sending v4 with other fixes until we can close on this one. I
> also have some vacation pending so there may be a delay in my replies.
I don't think we need to limit the total number of workers. It's not a
meaningful protection anyway (is it ok if max-1 CPUs are pinned in RT?), the
DL server already provides forward progress protection, and it doesn't make
sense to design this assuming malicious / incompetent users.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-07-22 19:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 9:02 [RFC v3 0/2] Realtime workqueues and panthor realtime submission Tvrtko Ursulin
2026-07-17 9:02 ` [RFC v3 1/2] workqueue: Add support for real-time workers Tvrtko Ursulin
2026-07-17 10:06 ` Tvrtko Ursulin
2026-07-22 19:05 ` Tejun Heo [this message]
2026-07-17 9:02 ` [RFC v3 2/2] drm/panthor: Create per queue priority workqueues Tvrtko Ursulin
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=amEUelR4oL_odDuq@slm.duckdns.org \
--to=tj@kernel.org \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=matthew.brost@intel.com \
--cc=olv@google.com \
--cc=olvaffe@gmail.com \
--cc=steven.price@arm.com \
--cc=tvrtko.ursulin@igalia.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®