Skip to contentSkip to conversation

replace system_unbound_wq and system_wq with the new wqs

PATCH In review Marco Crivellari 2 participants 10 messages Oct 30, 2025 – Feb 5

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

cover replace system_unbound_wq and system_wq with the new wqs

Hi,

=== Current situation: problems ===

Let's consider a nohz_full system with isolated CPUs: wq_unbound_cpumask is set to the housekeeping CPUs, for !WQ_UNBOUND the local CPU is selected.

This leads to different scenarios if a work item is scheduled on an isolated CPU where "delay" value is 0 or greater then 0:

        schedule_delayed_work(, 0);

This will be handled by __queue_work() that will queue the work item on the current local (isolated) CPU, while:

        schedule_delayed_work(, 1);

Will move the timer on an housekeeping CPU, and schedule the work there.

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 consistency cannot be addressed without refactoring the API.

=== Recent changes to the WQ API ===

The following, address the recent changes in the Workqueue API:

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

The old workqueues will be removed in a future release cycle.

=== Introduced Changes by this series ===

1) [P 1-2-3] Replace uses of system_wq and system_unbound_wq

system_wq is a per-CPU workqueue, but his name is not clear. system_unbound_wq is to be used when locality is not required.

Because of that, system_wq has been replaced with system_percpu_wq, and system_unbound_wq has been replaced with system_dfl_wq.

Thanks!

Marco Crivellari (3):
drm/atomic-helper: replace use of system_unbound_wq with system_dfl_wq drm/probe-helper: replace use of system_wq with system_percpu_wq drm/self_refresh: replace use of system_wq with system_percpu_wq

 drivers/gpu/drm/drm_atomic_helper.c       | 6 +++---
 drivers/gpu/drm/drm_probe_helper.c        | 2 +-
 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/3 drm/atomic-helper: replace use of system_unbound_wq with system_dfl_wq

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 consistency cannot be addressed without refactoring the API.

system_unbound_wq should be the default workqueue so as not to enforce locality constraints for random work whenever it's not required.

Adding system_dfl_wq to encourage its use when unbound work should be used.

The old system_unbound_wq will be kept for a few release cycles.

---
 drivers/gpu/drm/drm_atomic_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -3
index d5ebe6ea0acb..166085a7e681 100644
@@ -2222,13 +2222,13 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 	 * current layout.
 	 *
 	 * NOTE: Commit work has multiple phases, first hardware commit, then
-	 * cleanup. We want them to overlap, hence need system_unbound_wq to
+	 * cleanup. We want them to overlap, hence need system_dfl_wq to
 	 * make sure work items don't artificially stall on each another.
 	 */
 
 	drm_atomic_state_get(state);
 	if (nonblock)
-		queue_work(system_unbound_wq, &state->commit_work);
+		queue_work(system_dfl_wq, &state->commit_work);
 	else
 		commit_tail(state);
 
@@ -2261,7 +2261,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
  *
  * Asynchronous workers need to have sufficient parallelism to be able to run
  * different atomic commits on different CRTCs in parallel. The simplest way to
- * achieve this is by running them on the &system_unbound_wq work queue. Note
+ * achieve this is by running them on the &system_dfl_wq work queue. Note
  * that drivers are not required to split up atomic commits and run an
  * individual commit in parallel - userspace is supposed to do that if it cares.
  * But it might be beneficial to do that for modesets, since those necessarily
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/3 drm/probe-helper: replace use of system_wq with system_percpu_wq

In reply to Marco Crivellari

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 consistency cannot be addressed without refactoring the API.

system_wq should be the per-cpu workqueue, yet in this name nothing makes that clear, so replace system_wq with system_percpu_wq.

The old wq (system_wq) will be kept for a few release cycles.

---
 drivers/gpu/drm/drm_probe_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +1 -1
index 09b12c30df69..d4dc8cb45bce 100644
@@ -626,7 +626,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		 */
 		dev->mode_config.delayed_event = true;
 		if (dev->mode_config.poll_enabled)
-			mod_delayed_work(system_wq,
+			mod_delayed_work(system_percpu_wq,
 					 &dev->mode_config.output_poll_work,
 					 0);
 	}
Signature · 1 line
2.51.0
#3 lore raw

PATCH 3/3 drm/self_refresh: replace use of system_wq with system_percpu_wq

In reply to Marco Crivellari

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 consistency cannot be addressed without refactoring the API.

system_wq should be the per-cpu workqueue, yet in this name nothing makes that clear, so replace system_wq with system_percpu_wq.

The old wq (system_wq) will be kept for a few release cycles.

---
 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_self_refresh_helper.c +1 -1
index c0948586b7fd..36f4237efd4d 100644
@@ -218,7 +218,7 @@ void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state)
 			 ewma_psr_time_read(&sr_data->exit_avg_ms)) * 2;
 		mutex_unlock(&sr_data->avg_mutex);
 
-		mod_delayed_work(system_wq, &sr_data->entry_work,
+		mod_delayed_work(system_percpu_wq, &sr_data->entry_work,
 				 msecs_to_jiffies(delay));
 	}
 }
Signature · 1 line
2.51.0
#4 lore raw
In reply to Marco Crivellari

Hi,

Quoted 9 lines · Marco Crivellari

Marco Crivellari (3):
drm/atomic-helper: replace use of system_unbound_wq with system_dfl_wq drm/probe-helper: replace use of system_wq with system_percpu_wq drm/self_refresh: replace use of system_wq with system_percpu_wq

 drivers/gpu/drm/drm_atomic_helper.c       | 6 +++---
 drivers/gpu/drm/drm_probe_helper.c        | 2 +-
 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

Gentle ping.

Thanks!

Signature · 3 lines
Marco Crivellari

L3 Support Engineer, Technology & Product
#5 lore raw
Quoted 7 lines · Marco Crivellari
Quoted 5 lines · Marco Crivellari

Marco Crivellari (3):
drm/atomic-helper: replace use of system_unbound_wq with system_dfl_wq drm/probe-helper: replace use of system_wq with system_percpu_wq drm/self_refresh: replace use of system_wq with system_percpu_wq

Quoted 6 lines
Quoted 4 lines
 drivers/gpu/drm/drm_atomic_helper.c       | 6 +++---
 drivers/gpu/drm/drm_probe_helper.c        | 2 +-
 drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

Gentle ping.

Hi,

Gentle ping.

Thanks.

Signature · 3 lines
Marco Crivellari

L3 Support Engineer
maintainer Reviewed-by on the v1 series
#6 lore raw
In reply to Marco Crivellari

Hi

Am 30.10.25 um 17:20 schrieb Marco Crivellari:

Quoted 37 lines

Hi,

=== Current situation: problems ===

Let's consider a nohz_full system with isolated CPUs: wq_unbound_cpumask is set to the housekeeping CPUs, for !WQ_UNBOUND the local CPU is selected.

This leads to different scenarios if a work item is scheduled on an isolated CPU where "delay" value is 0 or greater then 0:

         schedule_delayed_work(, 0);

This will be handled by __queue_work() that will queue the work item on the current local (isolated) CPU, while:

         schedule_delayed_work(, 1);

Will move the timer on an housekeeping CPU, and schedule the work there.

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 consistency cannot be addressed without refactoring the API.

=== Recent changes to the WQ API ===

The following, address the recent changes in the Workqueue API:

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

The old workqueues will be removed in a future release cycle.

=== Introduced Changes by this series ===

Quoted 7 lines

1) [P 1-2-3] Replace uses of system_wq and system_unbound_wq

system_wq is a per-CPU workqueue, but his name is not clear. system_unbound_wq is to be used when locality is not required.

Because of that, system_wq has been replaced with system_percpu_wq, and system_unbound_wq has been replaced with system_dfl_wq.

From the description, I've found it hard to see if there's a change in semantics here. But this series is effectively about renaming AFAICT. If so,

for all patches.

Best regards
Thomas

Quoted 14 lines

Thanks!

Marco Crivellari (3):
drm/atomic-helper: replace use of system_unbound_wq with system_dfl_wq drm/probe-helper: replace use of system_wq with system_percpu_wq drm/self_refresh: replace use of system_wq with system_percpu_wq

  drivers/gpu/drm/drm_atomic_helper.c       | 6 +++---
  drivers/gpu/drm/drm_probe_helper.c        | 2 +-
  drivers/gpu/drm/drm_self_refresh_helper.c | 2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
#7 lore raw
Quoted 7 lines · Thomas Zimmermann

[...]
From the description, I've found it hard to see if there's a change in
semantics here. But this series is effectively about renaming AFAICT. If so,

for all patches.

Hi Thomas,

The new version of the changelog is more clear then this one. In case you want a cleaner version I can submit a new version.

Anyhow yes, in short the change is the introduction of system_percpu_wq and system_dfl_wq without changing the behavior:

system_wq -> system_percpu_wq
system_unbound_wq -> system_dfl_wq

Many thanks!

Signature · 3 lines
Marco Crivellari

L3 Support Engineer
#8 lore raw

Hi

Am 04.02.26 um 14:36 schrieb Marco Crivellari:

Quoted 5 lines · Thomas Zimmermann
Quoted 4 lines

[...]
From the description, I've found it hard to see if there's a change in
semantics here. But this series is effectively about renaming AFAICT. If so,

Quoted 7 lines
Quoted 3 lines

for all patches.

Hi Thomas,

The new version of the changelog is more clear then this one. In case you want a cleaner version I can submit a new version.

No need for an update.

Quoted 9 lines

Anyhow yes, in short the change is the introduction of system_percpu_wq and system_dfl_wq without changing the behavior:

    system_wq -> system_percpu_wq
    system_unbound_wq -> system_dfl_wq

Many thanks!

These patches go through DRM trees, right? I can merge them if no other reviews come in. Ping me if they get lost again.

Best regards
Thomas

Quoted 1 line
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
#9 lore raw

Hi,

Quoted 3 lines · Thomas Zimmermann

[...]
These patches go through DRM trees, right? I can merge them if no other reviews come in. Ping me if they get lost again.

Yes, sure I will, thank you!

Signature · 3 lines
Marco Crivellari

L3 Support Engineer