* [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq
2025-11-06 15:58 [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue Marco Crivellari
@ 2025-11-06 15:58 ` Marco Crivellari
2026-01-05 12:30 ` Jürgen Groß
2025-11-06 15:58 ` [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users Marco Crivellari
2025-12-24 15:05 ` [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue Marco Crivellari
2 siblings, 1 reply; 6+ messages in thread
From: Marco Crivellari @ 2025-11-06 15:58 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Marco Crivellari, Michal Hocko,
Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko
Currently if a user enqueues a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.
This lack of consistency cannot be addressed without refactoring the API.
This continues the effort to refactor workqueue APIs, which began with
the introduction of new workqueues and a new alloc_workqueue flag in:
commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
Switch to using system_percpu_wq because system_wq is going away as part of
a workqueue restructuring.
Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
---
drivers/xen/events/events_base.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 9478fae014e5..663df17776fd 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -581,7 +581,7 @@ static void lateeoi_list_add(struct irq_info *info)
eoi_list);
if (!elem || info->eoi_time < elem->eoi_time) {
list_add(&info->eoi_list, &eoi->eoi_list);
- mod_delayed_work_on(info->eoi_cpu, system_wq,
+ mod_delayed_work_on(info->eoi_cpu, system_percpu_wq,
&eoi->delayed, delay);
} else {
list_for_each_entry_reverse(elem, &eoi->eoi_list, eoi_list) {
@@ -666,7 +666,7 @@ static void xen_irq_lateeoi_worker(struct work_struct *work)
break;
if (now < info->eoi_time) {
- mod_delayed_work_on(info->eoi_cpu, system_wq,
+ mod_delayed_work_on(info->eoi_cpu, system_percpu_wq,
&eoi->delayed,
info->eoi_time - now);
break;
@@ -782,7 +782,7 @@ static void xen_free_irq(struct irq_info *info)
WARN_ON(info->refcnt > 0);
- queue_rcu_work(system_wq, &info->rwork);
+ queue_rcu_work(system_percpu_wq, &info->rwork);
}
/* Not called for lateeoi events. */
--
2.51.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq
2025-11-06 15:58 ` [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq Marco Crivellari
@ 2026-01-05 12:30 ` Jürgen Groß
0 siblings, 0 replies; 6+ messages in thread
From: Jürgen Groß @ 2026-01-05 12:30 UTC (permalink / raw)
To: Marco Crivellari, linux-kernel, xen-devel
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Michal Hocko, Stefano Stabellini,
Oleksandr Tyshchenko
[-- Attachment #1.1.1: Type: text/plain, Size: 1032 bytes --]
On 06.11.25 16:58, Marco Crivellari wrote:
> Currently if a user enqueues a work item using schedule_delayed_work() the
> used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
> WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
> schedule_work() that is using system_wq and queue_work(), that makes use
> again of WORK_CPU_UNBOUND.
>
> This lack of consistency cannot be addressed without refactoring the API.
>
> This continues the effort to refactor workqueue APIs, which began with
> the introduction of new workqueues and a new alloc_workqueue flag in:
>
> commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
> commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
>
> Switch to using system_percpu_wq because system_wq is going away as part of
> a workqueue restructuring.
>
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users
2025-11-06 15:58 [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue Marco Crivellari
2025-11-06 15:58 ` [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq Marco Crivellari
@ 2025-11-06 15:58 ` Marco Crivellari
2026-01-05 12:30 ` Jürgen Groß
2025-12-24 15:05 ` [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue Marco Crivellari
2 siblings, 1 reply; 6+ messages in thread
From: Marco Crivellari @ 2025-11-06 15:58 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Marco Crivellari, Michal Hocko,
Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko
Currently if a user enqueue a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.
This lack of consistentcy cannot be addressed without refactoring the API.
alloc_workqueue() treats all queues as per-CPU by default, while unbound
workqueues must opt-in via WQ_UNBOUND.
This default is suboptimal: most workloads benefit from unbound queues,
allowing the scheduler to place worker threads where they’re needed and
reducing noise when CPUs are isolated.
This continues the effort to refactor workqueue APIs, which began with
the introduction of new workqueues and a new alloc_workqueue flag in:
commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue()
to be per-cpu when WQ_UNBOUND has not been specified.
With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND),
any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND
must now use WQ_PERCPU.
Once migration is complete, WQ_UNBOUND can be removed and unbound will
become the implicit default.
Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
---
drivers/xen/privcmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index f52a457b302d..402be080ad2c 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -1091,7 +1091,8 @@ static long privcmd_ioctl_irqfd(struct file *file, void __user *udata)
static int privcmd_irqfd_init(void)
{
- irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", 0, 0);
+ irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", WQ_PERCPU,
+ 0);
if (!irqfd_cleanup_wq)
return -ENOMEM;
--
2.51.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users
2025-11-06 15:58 ` [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users Marco Crivellari
@ 2026-01-05 12:30 ` Jürgen Groß
0 siblings, 0 replies; 6+ messages in thread
From: Jürgen Groß @ 2026-01-05 12:30 UTC (permalink / raw)
To: Marco Crivellari, linux-kernel, xen-devel
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Michal Hocko, Stefano Stabellini,
Oleksandr Tyshchenko
[-- Attachment #1.1.1: Type: text/plain, Size: 1671 bytes --]
On 06.11.25 16:58, Marco Crivellari wrote:
> Currently if a user enqueue a work item using schedule_delayed_work() the
> used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
> WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
> schedule_work() that is using system_wq and queue_work(), that makes use
> again of WORK_CPU_UNBOUND.
> This lack of consistentcy cannot be addressed without refactoring the API.
>
> alloc_workqueue() treats all queues as per-CPU by default, while unbound
> workqueues must opt-in via WQ_UNBOUND.
>
> This default is suboptimal: most workloads benefit from unbound queues,
> allowing the scheduler to place worker threads where they’re needed and
> reducing noise when CPUs are isolated.
>
> This continues the effort to refactor workqueue APIs, which began with
> the introduction of new workqueues and a new alloc_workqueue flag in:
>
> commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
> commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
>
> This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue()
> to be per-cpu when WQ_UNBOUND has not been specified.
>
> With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND),
> any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND
> must now use WQ_PERCPU.
>
> Once migration is complete, WQ_UNBOUND can be removed and unbound will
> become the implicit default.
>
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue
2025-11-06 15:58 [PATCH 0/2] replace system_wq with system_percpu_wq, add WQ_PERCPU to alloc_workqueue Marco Crivellari
2025-11-06 15:58 ` [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq Marco Crivellari
2025-11-06 15:58 ` [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users Marco Crivellari
@ 2025-12-24 15:05 ` Marco Crivellari
2 siblings, 0 replies; 6+ messages in thread
From: Marco Crivellari @ 2025-12-24 15:05 UTC (permalink / raw)
To: linux-kernel, xen-devel
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Michal Hocko, Juergen Gross,
Stefano Stabellini, Oleksandr Tyshchenko
On Thu, Nov 6, 2025 at 4:58 PM Marco Crivellari
<marco.crivellari@suse.com> wrote:
> [...]
> xen/events: replace use of system_wq with system_percpu_wq
> xen: privcmd: WQ_PERCPU added to alloc_workqueue users
>
> drivers/xen/events/events_base.c | 6 +++---
> drivers/xen/privcmd.c | 3 ++-
> 2 files changed, 5 insertions(+), 4 deletions(-)
Gentle ping.
Thanks!
--
Marco Crivellari
L3 Support Engineer
^ permalink raw reply [flat|nested] 6+ messages in thread