ipvs: Replace use of system_unbound_wq with system_dfl_long_wq
Subsystems (4)
PATCH v3 1/1 ipvs: Replace use of system_unbound_wq with system_dfl_long_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, 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.
This specific work is considered long, so enqueue it using system_dfl_long_wq instead of system_dfl_wq.
---
Changes in v3:
- removed 1/2 "ipmr: Replace use of system_unbound_wq with system_dfl_wq" because already merged.
Changes in v2:
- this is considered a long work, so change the workqueue with system_dfl_long_wq
net/netfilter/ipvs/ip_vs_conn.c | 4 ++-- net/netfilter/ipvs/ip_vs_ctl.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +2 -2
@@ -285,7 +285,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)/* Schedule resizing if load increases */ if (atomic_read (&ipvs->conn_count) > t->u_thresh && !test_and_set_bit (IP_VS_WORK_CONN_RESIZE , &ipvs->work_flags)) -mod_delayed_work (system_unbound_wq, &ipvs->conn_resize_work,0 ); +mod_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work,0 );return ret; }
@@ -916,7 +916,7 @@ static void conn_resize_work_handler(struct work_struct *work) out:/* Monitor if we need to shrink table */ -queue_delayed_work (system_unbound_wq, &ipvs->conn_resize_work, +queue_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work, more_work ?1 :2 *HZ ); }
net/netfilter/ipvs/ip_vs_ctl.c +5 -5
@@ -821,7 +821,7 @@ static void svc_resize_work_handler(struct work_struct *work)if (!READ_ONCE (ipvs->enable) || !more_work ||test_bit (IP_VS_WORK_SVC_NORESIZE , &ipvs->work_flags))return ; -queue_delayed_work (system_unbound_wq, &ipvs->svc_resize_work,1 ); +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 );return ; unlock_m:
@@ -1869,7 +1869,7 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u,/* Schedule resize work */ if (grow && !test_and_set_bit (IP_VS_WORK_SVC_RESIZE , &ipvs->work_flags)) -queue_delayed_work (system_unbound_wq, &ipvs->svc_resize_work, +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 ); *svc_p = svc;
@@ -2122,7 +2122,7 @@ static int ip_vs_del_service(struct ip_vs_service *svc)rcu_read_unlock ();if (shrink && !test_and_set_bit (IP_VS_WORK_SVC_RESIZE , &ipvs->work_flags)) -queue_delayed_work (system_unbound_wq, +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 ); }return 0 ;
@@ -2564,7 +2564,7 @@ static int ipvs_proc_conn_lfactor(const struct ctl_table *table, int write, }else {WRITE_ONCE (*valp, val);if (rcu_access_pointer (ipvs->conn_tab)) -mod_delayed_work (system_unbound_wq, +mod_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work,0 ); } }
@@ -2596,7 +2596,7 @@ static int ipvs_proc_svc_lfactor(const struct ctl_table *table, int write, READ_ONCE(ipvs->enable) && !test_bit(IP_VS_WORK_SVC_NORESIZE, &ipvs->work_flags)) -mod_delayed_work (system_unbound_wq, +mod_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,0 );mutex_unlock (&ipvs->service_mutex); }
Signature · 1 line
2.54.0
Hello,
Quoted 22 lines · Marco Crivellari
This 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, 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.This specific work is considered long, so enqueue it using
system_dfl_long_wqinstead ofsystem_dfl_wq.
Quoted 10 lines
Cc Julian Anastasov <[email protected]>Cc Pablo Neira Ayuso <[email protected]>Cc Florian Westphal <[email protected]>Cc Phil Sutter <[email protected]>Suggested-by Tejun Heo <[email protected]>Signed-off-by Marco Crivellari <[email protected]>
Looks good to me for nf-next, thanks!
Quoted 85 lines
---
Changes in v3:
- removed 1/2 "ipmr: Replace use ofsystem_unbound_wqwithsystem_dfl_wq" because already merged.Changes in v2:
- this is considered a long work, so change the workqueue withsystem_dfl_long_wqnet/netfilter/ipvs/ip_vs_conn.c | 4 ++-- net/netfilter/ipvs/ip_vs_ctl.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)net/netfilter/ipvs/ip_vs_conn.c +2
-2@@ -285,7 +285,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)/* Schedule resizing if load increases */ if (atomic_read (&ipvs->conn_count) > t->u_thresh && !test_and_set_bit (IP_VS_WORK_CONN_RESIZE , &ipvs->work_flags)) -mod_delayed_work (system_unbound_wq, &ipvs->conn_resize_work,0 ); +mod_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work,0 );return ret; }@@ -916,7 +916,7 @@ static void conn_resize_work_handler(struct work_struct *work) out:/* Monitor if we need to shrink table */ -queue_delayed_work (system_unbound_wq, &ipvs->conn_resize_work, +queue_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work, more_work ?1 :2 *HZ ); }net/netfilter/ipvs/ip_vs_ctl.c +5
-5@@ -821,7 +821,7 @@ static void svc_resize_work_handler(struct work_struct *work)if (!READ_ONCE (ipvs->enable) || !more_work ||test_bit (IP_VS_WORK_SVC_NORESIZE , &ipvs->work_flags))return ; -queue_delayed_work (system_unbound_wq, &ipvs->svc_resize_work,1 ); +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 );return ; unlock_m:@@ -1869,7 +1869,7 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u,/* Schedule resize work */ if (grow && !test_and_set_bit (IP_VS_WORK_SVC_RESIZE , &ipvs->work_flags)) -queue_delayed_work (system_unbound_wq, &ipvs->svc_resize_work, +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 ); *svc_p = svc;@@ -2122,7 +2122,7 @@ static int ip_vs_del_service(struct ip_vs_service *svc)rcu_read_unlock ();if (shrink && !test_and_set_bit (IP_VS_WORK_SVC_RESIZE , &ipvs->work_flags)) -queue_delayed_work (system_unbound_wq, +queue_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,1 ); }return 0 ;@@ -2564,7 +2564,7 @@ static int ipvs_proc_conn_lfactor(const struct ctl_table *table, int write, }else {WRITE_ONCE (*valp, val);if (rcu_access_pointer (ipvs->conn_tab)) -mod_delayed_work (system_unbound_wq, +mod_delayed_work (system_dfl_long_wq, &ipvs->conn_resize_work,0 ); } }@@ -2596,7 +2596,7 @@ static int ipvs_proc_svc_lfactor(const struct ctl_table *table, int write, READ_ONCE(ipvs->enable) && !test_bit(IP_VS_WORK_SVC_NORESIZE, &ipvs->work_flags)) -mod_delayed_work (system_unbound_wq, +mod_delayed_work (system_dfl_long_wq, &ipvs->svc_resize_work,0 );mutex_unlock (&ipvs->service_mutex); }Signature · 1 line
2.54.0
Regards
--
Julian Anastasov <[email protected]>