replace system_unbound_wq and system_wq with the new wqs
Subsystems (2)
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
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
@@ -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
PATCH 2/3 drm/probe-helper: replace use of system_wq with system_percpu_wq
In reply to Marco CrivellariCurrently 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
@@ -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
PATCH 3/3 drm/self_refresh: replace use of system_wq with system_percpu_wq
In reply to Marco CrivellariCurrently 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
@@ -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
Hi,
Quoted 9 lines · Marco Crivellari
Marco Crivellari (3):
drm/atomic-helper: replace use ofsystem_unbound_wqwithsystem_dfl_wqdrm/probe-helper: replace use ofsystem_wqwithsystem_percpu_wqdrm/self_refresh: replace use ofsystem_wqwithsystem_percpu_wqdrivers/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
Quoted 7 lines · Marco Crivellari
Quoted 5 lines · Marco Crivellari
Marco Crivellari (3):
drm/atomic-helper: replace use ofsystem_unbound_wqwithsystem_dfl_wqdrm/probe-helper: replace use ofsystem_wqwithsystem_percpu_wqdrm/self_refresh: replace use ofsystem_wqwithsystem_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
Hi
Am 30.10.25 um 17:20 schrieb Marco Crivellari:
Quoted 37 lines
Hi,
=== Current situation: problems ===
Let's consider a
nohz_fullsystem with isolated CPUs:wq_unbound_cpumaskis 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) whilequeue_delayed_work()useWORK_CPU_UNBOUND(used when a cpu is not specified). The same applies toschedule_work()that is usingsystem_wqandqueue_work(), that makes use again ofWORK_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: Addsystem_percpu_wqandsystem_dfl_wq")
- commit930c2ea566af("workqueue: Add newWQ_PERCPUflag")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_wqandsystem_unbound_wq
system_wqis a per-CPU workqueue, but his name is not clear.system_unbound_wqis to be used when locality is not required.Because of that,
system_wqhas been replaced withsystem_percpu_wq, andsystem_unbound_wqhas been replaced withsystem_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 ofsystem_unbound_wqwithsystem_dfl_wqdrm/probe-helper: replace use ofsystem_wqwithsystem_percpu_wqdrm/self_refresh: replace use ofsystem_wqwithsystem_percpu_wqdrivers/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)
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,Reviewed-by Thomas Zimmermann <[email protected]>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
Thomas Zimmermann
maintainerHi
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
Reviewed-by Thomas Zimmermann <[email protected]>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_wqandsystem_dfl_wqwithout changing the behavior:system_wq -> system_percpu_wq system_unbound_wq -> system_dfl_wqMany 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)
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