From: Breno Leitao <leitao@debian.org>
To: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org, marco.crivellari@suse.com,
frederic@kernel.org, Breno Leitao <leitao@debian.org>,
kernel-team@meta.com
Subject: [PATCH RFC 0/3] Refactor the workqueue allocations
Date: Tue, 14 Jul 2026 04:41:46 -0700 [thread overview]
Message-ID: <20260714-tejun1-v1-0-024d59241386@debian.org> (raw)
POC for Tejun's idea to unify the per-cpu and unbound workqueues, as
suggested in http://lkml.kernel.org/r/ak569WYSm3ygKl1-@slm.duckdns.org
This series only unifies the allocation part (alloc_pwq()). It makes
alloc_pwq() a single allocator that returns a pwq backed by either a static
per-cpu pool (get_percpu_pool) or an unbound pool (get_unbound_pool), reusing
the existing static per-cpu pools. The install/link path is unchanged and all
patches are behavior-neutral. This sets things up to unify the install side
later.
Is this the right direction?
Questions to follow up:
1) wqattrs is an unbound concept and apply_workqueue_attrs_locked() rejects
non-unbound wqs. Should we leverage wqattrs in per-cpu workqueues as well,
so the unification can happen later (apply_workqueue_attrs_locked())?
2) If percpu becomes a WQ_AFFN_CPU affinity setting, how should max_active be
treated? WQ_AFFN_CPU is unbound today, so it would inherit per-node
accounting (wq_node_nr_active) and lose percpu's per-cpu max_active
(pwq->nr_active).
3) What end state are you aiming for? Keep WQ_PERCPU as a thin flag over
unified internals (single install path, per-cpu accounting special-cased)
with WQ_UNBOUND staying for now -- or something more radical (the flags gone
entirely, percpu purely an affinity value)?
Tests:
1) I've tested this on x86 and arm64, with regular tests
2) I've hacked up a workqueue test suite, which has a bunch of tests,
and this is what I am using to test these changes:
https://github.com/leitao/wqtest
Thanks,
-breno
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (3):
workqueue: introduce alloc_pwq()
workqueue: allocate percpu pwqs through alloc_pwq()
workqueue: factor out alloc_and_link_percpu_pwqs()
kernel/workqueue.c | 96 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 60 insertions(+), 36 deletions(-)
---
base-commit: b9810cd75b9fb56a3425d391cba3f608502bd474
change-id: 20260709-tejun1-c2aaf36f54a4
Best regards,
--
Breno Leitao <leitao@debian.org>
next reply other threads:[~2026-07-14 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 11:41 Breno Leitao [this message]
2026-07-14 11:41 ` [PATCH RFC 1/3] workqueue: introduce alloc_pwq() Breno Leitao
2026-07-14 11:41 ` [PATCH RFC 2/3] workqueue: allocate percpu pwqs through alloc_pwq() Breno Leitao
2026-07-14 11:41 ` [PATCH RFC 3/3] workqueue: factor out alloc_and_link_percpu_pwqs() Breno Leitao
2026-07-16 19:22 ` [PATCH RFC 0/3] Refactor the workqueue allocations Tejun Heo
2026-07-16 19:24 ` Tejun Heo
2026-07-17 16:25 ` Breno Leitao
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=20260714-tejun1-v1-0-024d59241386@debian.org \
--to=leitao@debian.org \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@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
Powered by JetHome