Skip to contentSkip to conversation

replace uses of system_wq with system_percpu_wq, request alloc_workqueue to be per-cpu

PATCH In review Marco Crivellari 2 participants 6 messages Nov 27, 2025 – Nov 28, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover replace uses of system_wq with system_percpu_wq, request alloc_workqueue to be per-cpu

Hi,

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")

More information can be found at the link below:

	https://lore.kernel.org/all/[email protected]/

=== Changes introduced by this series ===

1) [P 1] Request alloc_workqueue() to be per-cpu if WQ_UNBOUND is not present

The refactoring is going to alter the default behavior of alloc_workqueue() to be unbound by default.

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.

2) [P 2-3]

Workqueue users must be converted to the better named new workqueues with no intended behaviour changes:

system_wq -> system_percpu_wq system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be removed in the future.

Thanks!

---
Changes in v2:
- Patches grouped in 1 single series

- commit logs improved

Marco Crivellari (3):
platform/surface: acpi-notify: add WQ_PERCPU to alloc_workqueue users
platform: x86: replace use of system_wq with system_percpu_wq
platform: surface: replace use of system_wq with system_percpu_wq

 drivers/platform/surface/aggregator/ssh_packet_layer.c     | 2 +-
 drivers/platform/surface/aggregator/ssh_request_layer.c    | 2 +-
 drivers/platform/surface/surface_acpi_notify.c             | 2 +-
 drivers/platform/x86/gpd-pocket-fan.c                      | 4 ++--
 drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.51.1
#1 lore raw

PATCH v2 1/3 platform/surface: acpi-notify: add WQ_PERCPU to alloc_workqueue users

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")

The refactoring is going to alter the default behavior of alloc_workqueue() to be unbound by default.

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. For more details see the Link tag below.

In order to keep alloc_workqueue() behavior identical, explicitly request WQ_PERCPU.

---
 drivers/platform/surface/surface_acpi_notify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/surface/surface_acpi_notify.c +1 -1
index 3b30cfe3466b..a9dcb0bbe90e 100644
@@ -862,7 +862,7 @@ static int __init san_init(void)
 {
 	int ret;
 
-	san_wq = alloc_workqueue("san_wq", 0, 0);
+	san_wq = alloc_workqueue("san_wq", WQ_PERCPU, 0);
 	if (!san_wq)
 		return -ENOMEM;
 	ret = platform_driver_register(&surface_acpi_notify);
Signature · 1 line
2.51.1
#2 lore raw

PATCH v2 2/3 platform: x86: replace use of system_wq with system_percpu_wq

In reply to Marco Crivellari

This patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new alloc_workqueue flag:

commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of workqueues to become unbound by default so that their workload placement is optimized by the scheduler.

Before that to happen after a careful review and conversion of each individual case, workqueue users must be converted to the better named new workqueues with no intended behaviour changes:

system_wq -> system_percpu_wq
system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be removed in the future.

---
 drivers/platform/x86/gpd-pocket-fan.c                      | 4 ++--
 drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/gpd-pocket-fan.c +2 -2
index 7a20f68ae206..c9236738f896 100644
@@ -112,14 +112,14 @@ static void gpd_pocket_fan_worker(struct work_struct *work)
 	gpd_pocket_fan_set_speed(fan, speed);
 
 	/* When mostly idle (low temp/speed), slow down the poll interval. */
-	queue_delayed_work(system_wq, &fan->work,
+	queue_delayed_work(system_percpu_wq, &fan->work,
 			   msecs_to_jiffies(4000 / (speed + 1)));
 }
 
 static void gpd_pocket_fan_force_update(struct gpd_pocket_fan_data *fan)
 {
 	fan->last_speed = -1;
-	mod_delayed_work(system_wq, &fan->work, 0);
+	mod_delayed_work(system_percpu_wq, &fan->work, 0);
 }
 
 static int gpd_pocket_fan_probe(struct platform_device *pdev)
drivers/platform/x86/x86-android-tablets/vexia_atla10_ec.c +1 -1
index 2f8cd8d9e0ab..ebbedfe5f4e8 100644
@@ -183,7 +183,7 @@ static void atla10_ec_external_power_changed(struct power_supply *psy)
 	struct atla10_ec_data *data = power_supply_get_drvdata(psy);
 
 	/* After charger plug in/out wait 0.5s for things to stabilize */
-	mod_delayed_work(system_wq, &data->work, HZ / 2);
+	mod_delayed_work(system_percpu_wq, &data->work, HZ / 2);
 }
 
 static const enum power_supply_property atla10_ec_psy_props[] = {
Signature · 1 line
2.51.1
#3 lore raw

PATCH v2 3/3 platform: surface: replace use of system_wq with system_percpu_wq

In reply to Marco Crivellari

This patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new alloc_workqueue flag:

commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of workqueues to become unbound by default so that their workload placement is optimized by the scheduler.

Before that to happen after a careful review and conversion of each individual case, workqueue users must be converted to the better named new workqueues with no intended behaviour changes:

system_wq -> system_percpu_wq
system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be removed in the future.

---
 drivers/platform/surface/aggregator/ssh_packet_layer.c  | 2 +-
 drivers/platform/surface/aggregator/ssh_request_layer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/surface/aggregator/ssh_packet_layer.c +1 -1
index 6081b0146d5f..3dd22856570f 100644
@@ -671,7 +671,7 @@ static void ssh_ptl_timeout_reaper_mod(struct ssh_ptl *ptl, ktime_t now,
 	/* Re-adjust / schedule reaper only if it is above resolution delta. */
 	if (ktime_before(aexp, ptl->rtx_timeout.expires)) {
 		ptl->rtx_timeout.expires = expires;
-		mod_delayed_work(system_wq, &ptl->rtx_timeout.reaper, delta);
+		mod_delayed_work(system_percpu_wq, &ptl->rtx_timeout.reaper, delta);
 	}
 
 	spin_unlock(&ptl->rtx_timeout.lock);
drivers/platform/surface/aggregator/ssh_request_layer.c +1 -1
index 879ca9ee7ff6..a356e4956562 100644
@@ -434,7 +434,7 @@ static void ssh_rtl_timeout_reaper_mod(struct ssh_rtl *rtl, ktime_t now,
 	/* Re-adjust / schedule reaper only if it is above resolution delta. */
 	if (ktime_before(aexp, rtl->rtx_timeout.expires)) {
 		rtl->rtx_timeout.expires = expires;
-		mod_delayed_work(system_wq, &rtl->rtx_timeout.reaper, delta);
+		mod_delayed_work(system_percpu_wq, &rtl->rtx_timeout.reaper, delta);
 	}
 
 	spin_unlock(&rtl->rtx_timeout.lock);
Signature · 1 line
2.51.1
maintainer
#4 lore raw
In reply to Marco Crivellari
Quoted 9 lines · Marco Crivellari

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")

More information can be found at the link below:

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/3] platform/surface: acpi-notify: add WQ_PERCPU to alloc_workqueue users

      commit: f03dd5dd736d6aea94406a273be2a10f84bc60e1
[2/3] platform: x86: replace use of system_wq with system_percpu_wq
      commit: db4399501c58ad1225105224e7c9f03bc3d4fe39
[3/3] platform: surface: replace use of system_wq with system_percpu_wq
      commit: f720239ca39d72657e1bbf9c4c6270c78f548e43

--
i.

#5 lore raw
Quoted 6 lines · Ilpo Järvinen

[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

Quoted 7 lines

The list of commits applied:
[1/3] platform/surface: acpi-notify: add WQ_PERCPU to alloc_workqueue users

      commit: f03dd5dd736d6aea94406a273be2a10f84bc60e1
[2/3] platform: x86: replace use of system_wq with system_percpu_wq
      commit: db4399501c58ad1225105224e7c9f03bc3d4fe39
[3/3] platform: surface: replace use of system_wq with system_percpu_wq
      commit: f720239ca39d72657e1bbf9c4c6270c78f548e43

Many thanks!

Signature · 3 lines
Marco Crivellari

L3 Support Engineer, Technology & Product