Skip to contentSkip to conversation

ipvs: Move defense_work and est_reload_work to system_dfl_long_wq

PATCH In review Ismael Luceno 2 participants 3 messages Jul 2 – Jul 3

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

PATCH v2 1/1 ipvs: Move defense_work and est_reload_work to system_dfl_long_wq

Under synflood conditions binding these handlers to system_long_wq may pin them to a saturated CPU.

We've observed improved throughtput on a DPDK/VPP application with this change, which we attribute to the reduced context switching.

Neither handler has per-CPU data dependencies nor cache locality requirements that would prevent this change.

---
CC: Marco Crivellari <[email protected]>
CC: Tejun Heo <[email protected]>

Changes since v1:
* Rebased on nf-next
* Reworded commit message

 net/netfilter/ipvs/ip_vs_ctl.c | 6 +++---
 net/netfilter/ipvs/ip_vs_est.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +3 -3
index bcf40b8c41cf..d7e669efab4d 100644
@@ -235,7 +235,7 @@ #define DEFENSE_TIMER_PERIOD	1*HZ
 	update_defense_level(ipvs);
 	if (atomic_read(&ipvs->dropentry))
 		ip_vs_random_dropentry(ipvs);
-	queue_delayed_work(system_long_wq, &ipvs->defense_work,
+	queue_delayed_work(system_dfl_long_wq, &ipvs->defense_work,
 			   DEFENSE_TIMER_PERIOD);
 }
 #endif
@@ -290,7 +290,7 @@ #define DEFENSE_TIMER_PERIOD	1*HZ
 	atomic_set(&ipvs->est_genid_done, genid);
 
 	if (repeat)
-		queue_delayed_work(system_long_wq, &ipvs->est_reload_work,
+		queue_delayed_work(system_dfl_long_wq, &ipvs->est_reload_work,
 				   delay);
 
 unlock:
@@ -5126,7 +5126,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 		goto err;
 
 	/* Schedule defense work */
-	queue_delayed_work(system_long_wq, &ipvs->defense_work,
+	queue_delayed_work(system_dfl_long_wq, &ipvs->defense_work,
 			   DEFENSE_TIMER_PERIOD);
 
 	return 0;
net/netfilter/ipvs/ip_vs_est.c +1 -1
index ab09f5182951..78964aa861e9 100644
@@ -243,7 +243,7 @@ #define pr_fmt(fmt) "IPVS: " fmt
 	/* Bump the kthread configuration genid if stopping is requested */
 	if (restart)
 		atomic_inc(&ipvs->est_genid);
-	queue_delayed_work(system_long_wq, &ipvs->est_reload_work, 0);
+	queue_delayed_work(system_dfl_long_wq, &ipvs->est_reload_work, 0);
 }
 
 /* Start kthread task with current configuration */
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Ismael Luceno

Hello,

Quoted 10 lines · Ismael Luceno

Under synflood conditions binding these handlers to system_long_wq may pin them to a saturated CPU.

We've observed improved throughtput on a DPDK/VPP application with this change, which we attribute to the reduced context switching.

Neither handler has per-CPU data dependencies nor cache locality requirements that would prevent this change.

Looks good to me, thanks!

Quoted 48 lines

---
CC: Marco Crivellari <[email protected]>
CC: Tejun Heo <[email protected]>

Changes since v1:
* Rebased on nf-next
* Reworded commit message

 net/netfilter/ipvs/ip_vs_ctl.c | 6 +++---
 net/netfilter/ipvs/ip_vs_est.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +3 -3
index bcf40b8c41cf..d7e669efab4d 100644
@@ -235,7 +235,7 @@ #define DEFENSE_TIMER_PERIOD	1*HZ
 	update_defense_level(ipvs);
 	if (atomic_read(&ipvs->dropentry))
 		ip_vs_random_dropentry(ipvs);
-	queue_delayed_work(system_long_wq, &ipvs->defense_work,
+	queue_delayed_work(system_dfl_long_wq, &ipvs->defense_work,
 			   DEFENSE_TIMER_PERIOD);
 }
 #endif
@@ -290,7 +290,7 @@ #define DEFENSE_TIMER_PERIOD	1*HZ
 	atomic_set(&ipvs->est_genid_done, genid);
 
 	if (repeat)
-		queue_delayed_work(system_long_wq, &ipvs->est_reload_work,
+		queue_delayed_work(system_dfl_long_wq, &ipvs->est_reload_work,
 				   delay);
 
 unlock:
@@ -5126,7 +5126,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 		goto err;
 
 	/* Schedule defense work */
-	queue_delayed_work(system_long_wq, &ipvs->defense_work,
+	queue_delayed_work(system_dfl_long_wq, &ipvs->defense_work,
 			   DEFENSE_TIMER_PERIOD);
 
 	return 0;
net/netfilter/ipvs/ip_vs_est.c +0 -0
index ab09f5182951..78964aa861e9 100644

net/netfilter/ipvs/ip_vs_est.c #define pr_fmt(fmt) "IPVS: " fmt · line 249

Quoted 8 lines
net/netfilter/ipvs/ip_vs_est.c +1 -1
@@ -243,7 +243,7 @@ #define pr_fmt(fmt) "IPVS: " fmt
 	/* Bump the kthread configuration genid if stopping is requested */
 	if (restart)
 		atomic_inc(&ipvs->est_genid);
-	queue_delayed_work(system_long_wq, &ipvs->est_reload_work, 0);
+	queue_delayed_work(system_dfl_long_wq, &ipvs->est_reload_work, 0);
 }
 
 /* Start kthread task with current configuration */

Regards

--
Julian Anastasov <[email protected]>