cxl/pci: replace use of system_wq with system_percpu_wq
PATCH 1/1 cxl/pci: replace use of system_wq with system_percpu_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_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/cxl/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/pci.c +1 -1
@@ -136,7 +136,7 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id)if (opcode ==CXL_MBOX_OP_SANITIZE ) {mutex_lock (&cxl_mbox->mbox_mutex);if (mds->security.sanitize_node) -mod_delayed_work (system_wq, &mds->security.poll_dwork,0 ); +mod_delayed_work (system_percpu_wq, &mds->security.poll_dwork,0 );mutex_unlock (&cxl_mbox->mbox_mutex); }else {/* short-circuit the wait in __cxl_pci_mbox_send_cmd() */
Signature · 1 line
2.51.0
Quoted 8 lines · Marco Crivellari
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.
Quoted 7 lines
system_wqshould be the per-cpu workqueue, yet in this name nothing makes that clear, so replacesystem_wqwithsystem_percpu_wq.The old wq (
system_wq) will be kept for a few release cycles.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>
Quoted 16 lines
drivers/cxl/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cxl/pci.c +1
-1@@ -136,7 +136,7 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id)if (opcode ==CXL_MBOX_OP_SANITIZE ) {mutex_lock (&cxl_mbox->mbox_mutex);if (mds->security.sanitize_node) -mod_delayed_work (system_wq, &mds->security.poll_dwork,0 ); +mod_delayed_work (system_percpu_wq, &mds->security.poll_dwork,0 );mutex_unlock (&cxl_mbox->mbox_mutex); }else {/* short-circuit the wait in __cxl_pci_mbox_send_cmd() */
Quoted 6 lines · Marco Crivellari
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.
Quoted 6 lines
This lack of consistency cannot be addressed without refactoring the API.
system_wqshould be the per-cpu workqueue, yet in this name nothing makes that clear, so replacesystem_wqwithsystem_percpu_wq.The old wq (
system_wq) will be kept for a few release cycles.
A reference to:
commit 128ea9f6ccfb6960293ae4212f4f97165e42222d
Author: Marco Crivellari <[email protected]> Date: Sat Jun 14 15:35:29 2025 +0200
workqueue: Add system_percpu_wq and system_dfl_wq
...
Would have been nice just to save reviewers time. Regardless.
[snip]
Quoted 7 lines · Ira Weiny
[...]
A reference to:commit
128ea9f6ccfb6960293ae4212f4f97165e42222dAuthor: Marco Crivellari <[email protected]> Date: Sat Jun 14 15:35:29 2025 +0200
Quoted 7 lines
workqueue: Add
system_percpu_wqandsystem_dfl_wq...
Would have been nice just to save reviewers time. Regardless.
Reviewed-by Ira Weiny <[email protected]>
Many thanks, and sorry for the trouble!
--
Marco Crivellari
L3 Support Engineer, Technology & Product
Quoted 8 lines · Marco Crivellari
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.
Quoted 7 lines
system_wqshould be the per-cpu workqueue, yet in this name nothing makes that clear, so replacesystem_wqwithsystem_percpu_wq.The old wq (
system_wq) will be kept for a few release cycles.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>
Quoted 8 lines · Marco Crivellari
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.
Quoted 7 lines
system_wqshould be the per-cpu workqueue, yet in this name nothing makes that clear, so replacesystem_wqwithsystem_percpu_wq.The old wq (
system_wq) will be kept for a few release cycles.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>
Applied to cxl/next952e9057e66c17a9718232664368ffdaca468f93
Quoted 17 lines
--- drivers/cxl/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cxl/pci.c +1
-1@@ -136,7 +136,7 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id)if (opcode ==CXL_MBOX_OP_SANITIZE ) {mutex_lock (&cxl_mbox->mbox_mutex);if (mds->security.sanitize_node) -mod_delayed_work (system_wq, &mds->security.poll_dwork,0 ); +mod_delayed_work (system_percpu_wq, &mds->security.poll_dwork,0 );mutex_unlock (&cxl_mbox->mbox_mutex); }else {/* short-circuit the wait in __cxl_pci_mbox_send_cmd() */
Quoted 3 lines · Dave Jiang
[...]
Applied to cxl/next952e9057e66c17a9718232664368ffdaca468f93
Many thanks Dave!
Signature · 3 lines
Marco Crivellari L3 Support Engineer, Technology & Product