Replace uses of system_wq and system_unbound_wq
v2 cover Replace uses of system_wq and system_unbound_wq
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_unbound_wq and system_wq
Switch to using system_dfl_wq and system_percpu_wq because system_unbound_wq and system_wq are going away
as part of a workqueue restructuring.
No intended behavior changes:
system_wq -> system_percpu_wq
system_unbound_wq -> system_dfl_wq
Thanks!
---
Changes in v2:
- improved commit logs
- P3: wrong commit log was about system_unbound_wq; subject changed with system_wq.
Marco Crivellari (3):
wifi: iwlwifi: replace use of system_unbound_wq with system_dfl_wq
wifi: iwlwifi: fw: replace use of system_unbound_wq with system_dfl_wq
wifi: iwlwifi: nvm: replace use of system_wq with system_percpu_wq
drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.51.1
PATCH v2 1/3 wifi: iwlwifi: replace use of system_unbound_wq with system_dfl_wq
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/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +1 -1
@@ -1092,7 +1092,7 @@ static inline void iwl_trans_schedule_reset(struct iwl_trans *trans,*/ trans->restart.during_reset =test_bit (STATUS_IN_SW_RESET , &trans->status); -queue_delayed_work (system_unbound_wq, &trans->restart.wk,0 ); +queue_delayed_work (system_dfl_wq, &trans->restart.wk,0 ); } static inline void iwl_trans_fw_error(struct iwl_trans *trans,
Signature · 1 line
2.51.1
RE: [PATCH v2 1/3] wifi: iwlwifi: replace use of system_unbound_wq with system_dfl_wq
Quoted 56 lines
-----Original Message-----
From: Marco Crivellari <[email protected]>
Sent: Thursday, November 20, 2025 12:09 PM
To: [email protected]; [email protected]
Cc: Tejun Heo <[email protected]>; Lai Jiangshan <[email protected]>; Frederic Weisbecker <[email protected]>; Sebastian Andrzej Siewior <[email protected]>; Marco Crivellari <[email protected]>; Michal Hocko <[email protected]>; Korenblit, Miriam Rachel <[email protected]>; Johannes Berg <[email protected]>
Subject: [PATCH v2 1/3] wifi: iwlwifi: replace use ofsystem_unbound_wqwithsystem_dfl_wqThis patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new
alloc_workqueueflag:commit
128ea9f6ccfb("workqueue: Addsystem_percpu_wqandsystem_dfl_wq")
commit930c2ea566af("workqueue: Add newWQ_PERCPUflag")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_wqThis way the old obsolete workqueues (
system_wq,system_unbound_wq) can be removed in the future.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>--- drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/intel/iwlwifi/iwl-trans.h +1
-1@@ -1092,7 +1092,7 @@ static inline void iwl_trans_schedule_reset(structiwl_trans *trans, */ trans->restart.during_reset =test_bit (STATUS_IN_SW_RESET , &trans->status); -queue_delayed_work (system_unbound_wq, &trans->restart.wk,0 ); +queue_delayed_work (system_dfl_wq, &trans->restart.wk,0 ); }
Quoted 3 lines
static inline void iwl_trans_fw_error(struct
iwl_trans*trans,
--
2.51.1
PATCH v2 2/3 wifi: iwlwifi: fw: replace use of system_unbound_wq with system_dfl_wq
In reply to Marco CrivellariThis 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/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
@@ -2933,7 +2933,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,IWL_WARN (fwrt,"Collecting data: trigger %d fired.\n" ,le32_to_cpu (desc->trig_desc.type)); -queue_delayed_work (system_unbound_wq, &wk_data->wk, +queue_delayed_work (system_dfl_wq, &wk_data->wk,usecs_to_jiffies (delay));return 0 ;
@@ -3237,7 +3237,7 @@ int iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt,if (sync)iwl_fw_dbg_collect_sync (fwrt, idx);else -queue_delayed_work (system_unbound_wq, +queue_delayed_work (system_dfl_wq, &fwrt->dump.wks[idx].wk,usecs_to_jiffies (delay));
Signature · 1 line
2.51.1
RE: [PATCH v2 2/3] wifi: iwlwifi: fw: replace use of system_unbound_wq with system_dfl_wq
Quoted 68 lines
-----Original Message-----
From: Marco Crivellari <[email protected]>
Sent: Thursday, November 20, 2025 12:09 PM
To: [email protected]; [email protected]
Cc: Tejun Heo <[email protected]>; Lai Jiangshan <[email protected]>; Frederic Weisbecker <[email protected]>; Sebastian Andrzej Siewior <[email protected]>; Marco Crivellari <[email protected]>; Michal Hocko <[email protected]>; Korenblit, Miriam Rachel <[email protected]>; Johannes Berg <[email protected]>
Subject: [PATCH v2 2/3] wifi: iwlwifi: fw: replace use ofsystem_unbound_wqwithsystem_dfl_wqThis patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new
alloc_workqueueflag:commit
128ea9f6ccfb("workqueue: Addsystem_percpu_wqandsystem_dfl_wq")
commit930c2ea566af("workqueue: Add newWQ_PERCPUflag")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_wqThis way the old obsolete workqueues (
system_wq,system_unbound_wq) can be removed in the future.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1
-1@@ -2933,7 +2933,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,IWL_WARN (fwrt,"Collecting data: trigger %d fired.\n" ,le32_to_cpu (desc->trig_desc.type)); -queue_delayed_work (system_unbound_wq, &wk_data->wk, +queue_delayed_work (system_dfl_wq, &wk_data->wk,usecs_to_jiffies (delay));drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1
-2return 0 ;@@ -3237,7 +3237,7 @@ int iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt,if (sync)iwl_fw_dbg_collect_sync (fwrt, idx);else -queue_delayed_work (system_unbound_wq, +queue_delayed_work (system_dfl_wq, &fwrt->dump.wks[idx].wk,usecs_to_jiffies (delay)); --
Quoted 1 line
2.51.1
PATCH v2 3/3 wifi: iwlwifi: nvm: replace use of system_wq with system_percpu_wq
In reply to Marco CrivellariThis 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/net/wireless/intel/iwlwifi/mvm/tdls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c +3 -3
@@ -234,7 +234,7 @@ void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)* Also convert TU to msec. */ delay =TU_TO_MS (vif->bss_conf.dtim_period * vif->bss_conf.beacon_int); -mod_delayed_work (system_wq, &mvm->tdls_cs.dwork, +mod_delayed_work (system_percpu_wq, &mvm->tdls_cs.dwork,msecs_to_jiffies (delay));iwl_mvm_tdls_update_cs_state (mvm,IWL_MVM_TDLS_SW_ACTIVE );
@@ -548,7 +548,7 @@ iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,*/ delay =2 *TU_TO_MS (vif->bss_conf.dtim_period * vif->bss_conf.beacon_int); -mod_delayed_work (system_wq, &mvm->tdls_cs.dwork, +mod_delayed_work (system_percpu_wq, &mvm->tdls_cs.dwork,msecs_to_jiffies (delay));return 0 ; }
@@ -659,6 +659,6 @@ iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw,/* register a timeout in case we don't succeed in switching */ delay = vif->bss_conf.dtim_period * vif->bss_conf.beacon_int *1024 /1000 ; -mod_delayed_work (system_wq, &mvm->tdls_cs.dwork, +mod_delayed_work (system_percpu_wq, &mvm->tdls_cs.dwork,msecs_to_jiffies (delay)); }
Signature · 1 line
2.51.1
Korenblit, Miriam Rachel
maintainerRE: [PATCH v2 3/3] wifi: iwlwifi: nvm: replace use of system_wq with system_percpu_wq
Quoted 13 lines
-----Original Message-----
From: Marco Crivellari <[email protected]>
Sent: Thursday, November 20, 2025 12:09 PM
To: [email protected]; [email protected]
Cc: Tejun Heo <[email protected]>; Lai Jiangshan <[email protected]>; Frederic Weisbecker <[email protected]>; Sebastian Andrzej Siewior <[email protected]>; Marco Crivellari <[email protected]>; Michal Hocko <[email protected]>; Korenblit, Miriam Rachel <[email protected]>; Johannes Berg <[email protected]>
Subject: [PATCH v2 3/3] wifi: iwlwifi: nvm: replace use ofsystem_wqwith
Please change nvm->mvm.
Otherwise looks good to me
Quoted 27 lines
system_percpu_wqThis patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new
alloc_workqueueflag:commit
128ea9f6ccfb("workqueue: Addsystem_percpu_wqandsystem_dfl_wq")
commit930c2ea566af("workqueue: Add newWQ_PERCPUflag")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_wqThis way the old obsolete workqueues (
system_wq,system_unbound_wq) can be removed in the future.Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>---
2.51.1
Re: [PATCH v2 3/3] wifi: iwlwifi: nvm: replace use of system_wq with system_percpu_wq
Quoted 3 lines · Miriam Rachel
Please change
nvm->mvm.
Otherwise looks good to meQuoted 1 line
system_percpu_wq
Hi,
Ouch, sure, I will do and submit a new version.
Thanks!
Signature · 3 lines
Marco Crivellari L3 Support Engineer
Quoted 10 lines · Marco Crivellari
[...]
Marco Crivellari (3):
wifi: iwlwifi: replace use ofsystem_unbound_wqwithsystem_dfl_wq
wifi: iwlwifi: fw: replace use ofsystem_unbound_wqwithsystem_dfl_wq
wifi: iwlwifi: nvm: replace use ofsystem_wqwithsystem_percpu_wqdrivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
Gentle ping.
Thanks!
Signature · 3 lines
Marco Crivellari L3 Support Engineer
Quoted 6 lines · Marco Crivellari
[...]
Quoted 5 lines
Marco Crivellari (3):
wifi: iwlwifi: replace use ofsystem_unbound_wqwithsystem_dfl_wq
wifi: iwlwifi: fw: replace use ofsystem_unbound_wqwithsystem_dfl_wq
wifi: iwlwifi: nvm: replace use ofsystem_wqwithsystem_percpu_wq
Quoted 8 lines
Quoted 4 lines
drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)Gentle ping.
Thanks!
Gentle ping.
Thanks!
Signature · 3 lines
Marco Crivellari L3 Support Engineer