From: Frederic Weisbecker <frederic@kernel.org>
To: Tejun Heo <tj@kernel.org>
Cc: Marco Crivellari <marco.crivellari@suse.com>,
Breno Leitao <leitao@debian.org>,
linux-kernel@vger.kernel.org,
Lai Jiangshan <jiangshanlai@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Michal Hocko <mhocko@suse.com>
Subject: Re: [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag
Date: Wed, 8 Jul 2026 15:58:58 +0200 [thread overview]
Message-ID: <ak5Xom7Nmb1pDDgw@localhost.localdomain> (raw)
In-Reply-To: <ajw0L54oSnn5Z9as@slm.duckdns.org>
Le Wed, Jun 24, 2026 at 09:46:55AM -1000, Tejun Heo a écrit :
> Hello,
>
> On Tue, Jun 23, 2026 at 05:13:31PM +0200, Marco Crivellari wrote:
> > > - At boot time, allow selecting whether to back them with percpu wqs or
> > > WQ_AFFN_X unbound ones. Maybe we can even experiment with default to
> > > WQ_AFFN_CPU.
> >
> > You mentioned here "at boot time". What about making this also dynamic,
> > "moving" the WQs with WQ_PREFER_PERCPU away from CPU N when N is
> > isolated through a cgroup isolated partition?
>
> Yeah, being dynamic is better but switching dynamically between percpu and
> unbound workqueues feels like it's going to be complicated. I can't think of
> a simple way to do that. If you can, please be my guest.
I fear it's necessary to have dynamic isolation working correctly.
One way could be to make wq::cpu_pwq point to a pair of pwqs. One
for the isolated -> unbound configuration and another one for the
non_isolated -> per_cpu configuration.
Luckily it's fetched under RCU, so we can have that on one side:
housekeeping_update()
rcu_assign_pointer(housekeeping.cpumasks[HK_TYPE_DOMAIN], trial);
housekeeping.flags |= HK_FLAG_DOMAIN; // for housekeeping_enabled()
synchronize_rcu()
flush_workqueue(wq_prefer_percpu); // flush both wq->cpu_unbound_pwq and
wq->cpu_pwq
And that on the other side:
__queue_work()
rcu_read_lock()
unbound = false;
if (req_cpu == WORK_CPU_UNBOUND) {
if (wq->flags & WQ_UNBOUND || (housekeeping_enabled(HK_TYPE_DOMAIN) &&
wq->flags & WQ_PREFER_PERCPU)) {
unbound = true;
cpu = wq_select_unbound_cpu(raw_smp_processor_id());
} else {
cpu = raw_smp_processor_id();
}
}
if (unbound)
pwq = rcu_dereference(*per_cpu_ptr(wq->cpu_unbound_pwq, cpu));
else
pwq = rcu_dereference(*per_cpu_ptr(wq->cpu_pwq, cpu));
...
rcu_read_unlock()
Thanks.
--
Frederic Weisbecker
SUSE Labs
next prev parent reply other threads:[~2026-07-08 13:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 16:16 [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag Marco Crivellari
2026-05-05 16:16 ` [RFC PATCH 1/2] workqueue: Add queue_*() functions, future schedule_*() replacement Marco Crivellari
2026-05-05 16:16 ` [RFC PATCH 2/2] workqueue: Add WQ_PREFER_PERCPU and system_prefer_percpu_wq Marco Crivellari
2026-05-05 20:18 ` [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag Tejun Heo
2026-05-06 13:40 ` Breno Leitao
2026-05-07 10:25 ` Marco Crivellari
2026-05-07 21:27 ` Tejun Heo
2026-05-08 12:09 ` Frederic Weisbecker
2026-05-08 15:11 ` Tejun Heo
2026-05-12 8:52 ` Marco Crivellari
2026-06-23 15:13 ` Marco Crivellari
2026-06-24 19:46 ` Tejun Heo
2026-07-08 13:58 ` Frederic Weisbecker [this message]
2026-07-08 16:29 ` 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=ak5Xom7Nmb1pDDgw@localhost.localdomain \
--to=frederic@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=jiangshanlai@gmail.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=mhocko@suse.com \
--cc=tj@kernel.org \
/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