netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles
@ 2024-02-08 10:25 Eric Dumazet
  2024-02-08 10:25 ` [PATCH net-next 1/2] net/sched: act_api: uninline tc_action_net_init() and tc_action_net_exit() Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Dumazet @ 2024-02-08 10:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, netdev, eric.dumazet,
	Eric Dumazet

Adopt the new exit_batch_rtnl() method to avoid extra
rtnl_lock()//rtnl_unlock() pairs.

Eric Dumazet (2):
  net/sched: act_api: uninline tc_action_net_init() and
    tc_action_net_exit()
  net/sched: act_api: use exit_batch_rtnl() method

 include/net/act_api.h      | 34 +++-------------------------------
 net/sched/act_api.c        | 35 ++++++++++++++++++++++++++++++++---
 net/sched/act_bpf.c        |  7 ++++---
 net/sched/act_connmark.c   |  7 ++++---
 net/sched/act_csum.c       |  7 ++++---
 net/sched/act_ct.c         |  7 ++++---
 net/sched/act_ctinfo.c     |  7 ++++---
 net/sched/act_gact.c       |  7 ++++---
 net/sched/act_gate.c       |  7 ++++---
 net/sched/act_ife.c        |  7 ++++---
 net/sched/act_mirred.c     |  7 ++++---
 net/sched/act_mpls.c       |  7 ++++---
 net/sched/act_nat.c        |  7 ++++---
 net/sched/act_pedit.c      |  7 ++++---
 net/sched/act_police.c     |  7 ++++---
 net/sched/act_sample.c     |  7 ++++---
 net/sched/act_simple.c     |  7 ++++---
 net/sched/act_skbedit.c    |  7 ++++---
 net/sched/act_skbmod.c     |  7 ++++---
 net/sched/act_tunnel_key.c |  7 ++++---
 net/sched/act_vlan.c       |  7 ++++---
 21 files changed, 111 insertions(+), 91 deletions(-)

-- 
2.43.0.594.gd9cf4e227d-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net/sched: act_api: uninline tc_action_net_init() and tc_action_net_exit()
  2024-02-08 10:25 [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Eric Dumazet
@ 2024-02-08 10:25 ` Eric Dumazet
  2024-02-08 10:25 ` [PATCH net-next 2/2] net/sched: act_api: use exit_batch_rtnl() method Eric Dumazet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2024-02-08 10:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, netdev, eric.dumazet,
	Eric Dumazet

tc_action_net_init() and tc_action_net_exit() are slow path,
and quite big.

tcf_idrinfo_destroy() becomes static.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/act_api.h | 33 ++-------------------------------
 net/sched/act_api.c   | 36 +++++++++++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 77ee0c657e2c78276ecb2efca7f4c3d28be511a2..8ec97644edf86d5d95960b74b9b57908ca19a198 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -146,39 +146,10 @@ struct tc_action_net {
 	const struct tc_action_ops *ops;
 };
 
-static inline
 int tc_action_net_init(struct net *net, struct tc_action_net *tn,
-		       const struct tc_action_ops *ops)
-{
-	int err = 0;
-
-	tn->idrinfo = kmalloc(sizeof(*tn->idrinfo), GFP_KERNEL);
-	if (!tn->idrinfo)
-		return -ENOMEM;
-	tn->ops = ops;
-	tn->idrinfo->net = net;
-	mutex_init(&tn->idrinfo->lock);
-	idr_init(&tn->idrinfo->action_idr);
-	return err;
-}
-
-void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
-			 struct tcf_idrinfo *idrinfo);
-
-static inline void tc_action_net_exit(struct list_head *net_list,
-				      unsigned int id)
-{
-	struct net *net;
-
-	rtnl_lock();
-	list_for_each_entry(net, net_list, exit_list) {
-		struct tc_action_net *tn = net_generic(net, id);
+		       const struct tc_action_ops *ops);
 
-		tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
-		kfree(tn->idrinfo);
-	}
-	rtnl_unlock();
-}
+void tc_action_net_exit(struct list_head *net_list, unsigned int id);
 
 int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
 		       struct netlink_callback *cb, int type,
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 9ee622fb1160fe5de8df9a5fca0c9a412e40e31a..9492eae0ebe5844419e1631122871d19b443bc4e 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -886,8 +886,24 @@ int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index,
 }
 EXPORT_SYMBOL(tcf_idr_check_alloc);
 
-void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
-			 struct tcf_idrinfo *idrinfo)
+int tc_action_net_init(struct net *net, struct tc_action_net *tn,
+		       const struct tc_action_ops *ops)
+{
+	int err = 0;
+
+	tn->idrinfo = kmalloc(sizeof(*tn->idrinfo), GFP_KERNEL);
+	if (!tn->idrinfo)
+		return -ENOMEM;
+	tn->ops = ops;
+	tn->idrinfo->net = net;
+	mutex_init(&tn->idrinfo->lock);
+	idr_init(&tn->idrinfo->action_idr);
+	return err;
+}
+EXPORT_SYMBOL(tc_action_net_init);
+
+static void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
+				struct tcf_idrinfo *idrinfo)
 {
 	struct idr *idr = &idrinfo->action_idr;
 	struct tc_action *p;
@@ -904,7 +920,21 @@ void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
 	}
 	idr_destroy(&idrinfo->action_idr);
 }
-EXPORT_SYMBOL(tcf_idrinfo_destroy);
+
+void tc_action_net_exit(struct list_head *net_list, unsigned int id)
+{
+	struct net *net;
+
+	rtnl_lock();
+	list_for_each_entry(net, net_list, exit_list) {
+		struct tc_action_net *tn = net_generic(net, id);
+
+		tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
+		kfree(tn->idrinfo);
+	}
+	rtnl_unlock();
+}
+EXPORT_SYMBOL(tc_action_net_exit);
 
 static LIST_HEAD(act_base);
 static DEFINE_RWLOCK(act_mod_lock);
-- 
2.43.0.594.gd9cf4e227d-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] net/sched: act_api: use exit_batch_rtnl() method
  2024-02-08 10:25 [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Eric Dumazet
  2024-02-08 10:25 ` [PATCH net-next 1/2] net/sched: act_api: uninline tc_action_net_init() and tc_action_net_exit() Eric Dumazet
@ 2024-02-08 10:25 ` Eric Dumazet
  2024-02-08 22:10 ` [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Jamal Hadi Salim
  2024-02-09  2:37 ` Jakub Kicinski
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2024-02-08 10:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, netdev, eric.dumazet,
	Eric Dumazet

tc_action_net_exit() is called for each act module,
and grabs rtnl each time, making netns dismantles slow.

exit_batch_rtnl() is called while RTNL is already held,
saving one rtnl_lock()/rtnl_unlock() pair.

Rename tc_action_net_exit() to tc_action_net_exit_batch_rtnl()
and change all callers.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/act_api.h      | 3 ++-
 net/sched/act_api.c        | 7 +++----
 net/sched/act_bpf.c        | 7 ++++---
 net/sched/act_connmark.c   | 7 ++++---
 net/sched/act_csum.c       | 7 ++++---
 net/sched/act_ct.c         | 7 ++++---
 net/sched/act_ctinfo.c     | 7 ++++---
 net/sched/act_gact.c       | 7 ++++---
 net/sched/act_gate.c       | 7 ++++---
 net/sched/act_ife.c        | 7 ++++---
 net/sched/act_mirred.c     | 7 ++++---
 net/sched/act_mpls.c       | 7 ++++---
 net/sched/act_nat.c        | 7 ++++---
 net/sched/act_pedit.c      | 7 ++++---
 net/sched/act_police.c     | 7 ++++---
 net/sched/act_sample.c     | 7 ++++---
 net/sched/act_simple.c     | 7 ++++---
 net/sched/act_skbedit.c    | 7 ++++---
 net/sched/act_skbmod.c     | 7 ++++---
 net/sched/act_tunnel_key.c | 7 ++++---
 net/sched/act_vlan.c       | 7 ++++---
 21 files changed, 81 insertions(+), 62 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 8ec97644edf86d5d95960b74b9b57908ca19a198..2aa0060f51a6d7b0cbe0063792548469d41496e2 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -149,7 +149,8 @@ struct tc_action_net {
 int tc_action_net_init(struct net *net, struct tc_action_net *tn,
 		       const struct tc_action_ops *ops);
 
-void tc_action_net_exit(struct list_head *net_list, unsigned int id);
+void tc_action_net_exit_batch_rtnl(struct list_head *net_list,
+				   unsigned int id);
 
 int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
 		       struct netlink_callback *cb, int type,
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 9492eae0ebe5844419e1631122871d19b443bc4e..642ff499fa03cffe9873a987ee09ceb76707f2aa 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -921,20 +921,19 @@ static void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
 	idr_destroy(&idrinfo->action_idr);
 }
 
-void tc_action_net_exit(struct list_head *net_list, unsigned int id)
+void tc_action_net_exit_batch_rtnl(struct list_head *net_list, unsigned int id)
 {
 	struct net *net;
 
-	rtnl_lock();
+	ASSERT_RTNL();
 	list_for_each_entry(net, net_list, exit_list) {
 		struct tc_action_net *tn = net_generic(net, id);
 
 		tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
 		kfree(tn->idrinfo);
 	}
-	rtnl_unlock();
 }
-EXPORT_SYMBOL(tc_action_net_exit);
+EXPORT_SYMBOL(tc_action_net_exit_batch_rtnl);
 
 static LIST_HEAD(act_base);
 static DEFINE_RWLOCK(act_mod_lock);
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 0e3cf11ae5fc042f1e6f960fb5159153cc67fb27..cad8696ee505f6389cf5af56ea419650b1692d35 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -410,14 +410,15 @@ static __net_init int bpf_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_bpf_ops);
 }
 
-static void __net_exit bpf_exit_net(struct list_head *net_list)
+static void __net_exit bpf_exit_batch_rtnl(struct list_head *net_list,
+					   struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_bpf_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_bpf_ops.net_id);
 }
 
 static struct pernet_operations bpf_net_ops = {
 	.init = bpf_init_net,
-	.exit_batch = bpf_exit_net,
+	.exit_batch_rtnl = bpf_exit_batch_rtnl,
 	.id   = &act_bpf_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index 0fce631e7c91113e5559d12ddc4d0ebeef1237e4..110618266ddbd727fa0d207071288d7a101776d5 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -251,14 +251,15 @@ static __net_init int connmark_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_connmark_ops);
 }
 
-static void __net_exit connmark_exit_net(struct list_head *net_list)
+static void __net_exit connmark_exit_batch_rtnl(struct list_head *net_list,
+						struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_connmark_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_connmark_ops.net_id);
 }
 
 static struct pernet_operations connmark_net_ops = {
 	.init = connmark_init_net,
-	.exit_batch = connmark_exit_net,
+	.exit_batch_rtnl = connmark_exit_batch_rtnl,
 	.id   = &act_connmark_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 5cc8e407e7911c6c9f252d58b458728174913317..d2c2824317d5249ac86ddfa66e6f9d83afbded4c 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -718,14 +718,15 @@ static __net_init int csum_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_csum_ops);
 }
 
-static void __net_exit csum_exit_net(struct list_head *net_list)
+static void __net_exit csum_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_csum_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_csum_ops.net_id);
 }
 
 static struct pernet_operations csum_net_ops = {
 	.init = csum_init_net,
-	.exit_batch = csum_exit_net,
+	.exit_batch_rtnl = csum_exit_batch_rtnl,
 	.id   = &act_csum_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index baac083fd8f1096eb717a5ae6cd744ae15d6d17d..b3351e9a6ba541e3aefba70346aedd8b5a7de3a7 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -1609,14 +1609,15 @@ static __net_init int ct_init_net(struct net *net)
 	return tc_action_net_init(net, &tn->tn, &act_ct_ops);
 }
 
-static void __net_exit ct_exit_net(struct list_head *net_list)
+static void __net_exit ct_exit_batch_rtnl(struct list_head *net_list,
+					  struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_ct_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_ct_ops.net_id);
 }
 
 static struct pernet_operations ct_net_ops = {
 	.init = ct_init_net,
-	.exit_batch = ct_exit_net,
+	.exit_batch_rtnl = ct_exit_batch_rtnl,
 	.id   = &act_ct_ops.net_id,
 	.size = sizeof(struct tc_ct_action_net),
 };
diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c
index 5dd41a012110e04d4e7b199367a84fa1905156b3..5ee8b9ce32893782f99a75a1138e289fa8979e26 100644
--- a/net/sched/act_ctinfo.c
+++ b/net/sched/act_ctinfo.c
@@ -372,14 +372,15 @@ static __net_init int ctinfo_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_ctinfo_ops);
 }
 
-static void __net_exit ctinfo_exit_net(struct list_head *net_list)
+static void __net_exit ctinfo_exit_batch_rtnl(struct list_head *net_list,
+					      struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_ctinfo_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_ctinfo_ops.net_id);
 }
 
 static struct pernet_operations ctinfo_net_ops = {
 	.init		= ctinfo_init_net,
-	.exit_batch	= ctinfo_exit_net,
+	.exit_batch_rtnl = ctinfo_exit_batch_rtnl,
 	.id		= &act_ctinfo_ops.net_id,
 	.size		= sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index e949280eb800d9558cf101ced8f0d9742926c5f7..ada08c61b6d4dfcc521de6c31c848dbd386607f7 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -305,14 +305,15 @@ static __net_init int gact_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_gact_ops);
 }
 
-static void __net_exit gact_exit_net(struct list_head *net_list)
+static void __net_exit gact_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_gact_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_gact_ops.net_id);
 }
 
 static struct pernet_operations gact_net_ops = {
 	.init = gact_init_net,
-	.exit_batch = gact_exit_net,
+	.exit_batch_rtnl = gact_exit_batch_rtnl,
 	.id   = &act_gact_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
index 1dd74125398a0f41751fab72397f006b2c63d1db..65946e3450262aaf515d23d9fcf1e40f85f4bbc9 100644
--- a/net/sched/act_gate.c
+++ b/net/sched/act_gate.c
@@ -654,14 +654,15 @@ static __net_init int gate_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_gate_ops);
 }
 
-static void __net_exit gate_exit_net(struct list_head *net_list)
+static void __net_exit gate_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_gate_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_gate_ops.net_id);
 }
 
 static struct pernet_operations gate_net_ops = {
 	.init = gate_init_net,
-	.exit_batch = gate_exit_net,
+	.exit_batch_rtnl = gate_exit_batch_rtnl,
 	.id   = &act_gate_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 107c6d83dc5c4b586b534bacd7b185bcf891812a..ad11ef0aade95358a2463f7bd7d786c5981dbf37 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -898,14 +898,15 @@ static __net_init int ife_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_ife_ops);
 }
 
-static void __net_exit ife_exit_net(struct list_head *net_list)
+static void __net_exit ife_exit_batch_rtnl(struct list_head *net_list,
+					   struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_ife_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_ife_ops.net_id);
 }
 
 static struct pernet_operations ife_net_ops = {
 	.init = ife_init_net,
-	.exit_batch = ife_exit_net,
+	.exit_batch_rtnl = ife_exit_batch_rtnl,
 	.id   = &act_ife_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 93a96e9d8d900c238c9a84d75201b6edf01ba198..97429da4491f15aa78064785b28eb2eed0b2c3f1 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -652,14 +652,15 @@ static __net_init int mirred_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_mirred_ops);
 }
 
-static void __net_exit mirred_exit_net(struct list_head *net_list)
+static void __net_exit mirred_exit_batch_rtnl(struct list_head *net_list,
+					      struct list_head *batch_rtnl)
 {
-	tc_action_net_exit(net_list, act_mirred_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_mirred_ops.net_id);
 }
 
 static struct pernet_operations mirred_net_ops = {
 	.init = mirred_init_net,
-	.exit_batch = mirred_exit_net,
+	.exit_batch_rtnl = mirred_exit_batch_rtnl,
 	.id   = &act_mirred_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c
index 44a37a71ae9236cc1967239d6db8aba74d77355c..347d439f87f3f8d9586081a90106b3efebb3eeed 100644
--- a/net/sched/act_mpls.c
+++ b/net/sched/act_mpls.c
@@ -461,14 +461,15 @@ static __net_init int mpls_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_mpls_ops);
 }
 
-static void __net_exit mpls_exit_net(struct list_head *net_list)
+static void __net_exit mpls_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_mpls_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_mpls_ops.net_id);
 }
 
 static struct pernet_operations mpls_net_ops = {
 	.init = mpls_init_net,
-	.exit_batch = mpls_exit_net,
+	.exit_batch_rtnl = mpls_exit_batch_rtnl,
 	.id   = &act_mpls_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index d541f553805face5a0d444659c17e0b720aeb843..af43b962d66838af715172cdb7f304b3e37e6aef 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -333,14 +333,15 @@ static __net_init int nat_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_nat_ops);
 }
 
-static void __net_exit nat_exit_net(struct list_head *net_list)
+static void __net_exit nat_exit_batch_rtnl(struct list_head *net_list,
+					   struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_nat_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_nat_ops.net_id);
 }
 
 static struct pernet_operations nat_net_ops = {
 	.init = nat_init_net,
-	.exit_batch = nat_exit_net,
+	.exit_batch_rtnl = nat_exit_batch_rtnl,
 	.id   = &act_nat_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index df5a02d5f919c3e8b26308f5128ee35f63e5401a..9509760d4663b8b18e2e9431cdde3043263e6a6e 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -629,14 +629,15 @@ static __net_init int pedit_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_pedit_ops);
 }
 
-static void __net_exit pedit_exit_net(struct list_head *net_list)
+static void __net_exit pedit_exit_batch_rtnl(struct list_head *net_list,
+					     struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_pedit_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_pedit_ops.net_id);
 }
 
 static struct pernet_operations pedit_net_ops = {
 	.init = pedit_init_net,
-	.exit_batch = pedit_exit_net,
+	.exit_batch_rtnl = pedit_exit_batch_rtnl,
 	.id   = &act_pedit_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 8555125ed34d83eaadd36391da869bd46f2372fe..00ed38e2632131ee00bb751f2db17078417078da 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -511,14 +511,15 @@ static __net_init int police_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_police_ops);
 }
 
-static void __net_exit police_exit_net(struct list_head *net_list)
+static void __net_exit police_exit_batch_rtnl(struct list_head *net_list,
+					      struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_police_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_police_ops.net_id);
 }
 
 static struct pernet_operations police_net_ops = {
 	.init = police_init_net,
-	.exit_batch = police_exit_net,
+	.exit_batch_rtnl = police_exit_batch_rtnl,
 	.id   = &act_police_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index a69b53d54039eda131bea4d4022ce1b86506c275..7da5cd7701d31014abdcae7450c97215b2947d40 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -325,14 +325,15 @@ static __net_init int sample_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_sample_ops);
 }
 
-static void __net_exit sample_exit_net(struct list_head *net_list)
+static void __net_exit sample_exit_batch_rtnl(struct list_head *net_list,
+					      struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_sample_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_sample_ops.net_id);
 }
 
 static struct pernet_operations sample_net_ops = {
 	.init = sample_init_net,
-	.exit_batch = sample_exit_net,
+	.exit_batch_rtnl = sample_exit_batch_rtnl,
 	.id   = &act_sample_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index f3abe05459895661d9600f719379773a55a1c456..e2620722a2f77478b53d1e5423a3a7afb3c2b78a 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -218,14 +218,15 @@ static __net_init int simp_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_simp_ops);
 }
 
-static void __net_exit simp_exit_net(struct list_head *net_list)
+static void __net_exit simp_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_simp_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_simp_ops.net_id);
 }
 
 static struct pernet_operations simp_net_ops = {
 	.init = simp_init_net,
-	.exit_batch = simp_exit_net,
+	.exit_batch_rtnl = simp_exit_batch_rtnl,
 	.id   = &act_simp_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 1f1d9ce3e968a2342a524c068d15912623de058f..ac4784315133c5b670a6bcb33a4f46aa843f090f 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -435,14 +435,15 @@ static __net_init int skbedit_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_skbedit_ops);
 }
 
-static void __net_exit skbedit_exit_net(struct list_head *net_list)
+static void __net_exit skbedit_exit_batch_rtnl(struct list_head *net_list,
+					       struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_skbedit_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_skbedit_ops.net_id);
 }
 
 static struct pernet_operations skbedit_net_ops = {
 	.init = skbedit_init_net,
-	.exit_batch = skbedit_exit_net,
+	.exit_batch_rtnl = skbedit_exit_batch_rtnl,
 	.id   = &act_skbedit_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index 39945b139c4817584fb9803b9e65c89fef68eca0..cf01c94d2453cef229dbdb8ecb029af63ebb2b04 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -296,14 +296,15 @@ static __net_init int skbmod_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_skbmod_ops);
 }
 
-static void __net_exit skbmod_exit_net(struct list_head *net_list)
+static void __net_exit skbmod_exit_batch_rtnl(struct list_head *net_list,
+					      struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_skbmod_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_skbmod_ops.net_id);
 }
 
 static struct pernet_operations skbmod_net_ops = {
 	.init = skbmod_init_net,
-	.exit_batch = skbmod_exit_net,
+	.exit_batch_rtnl = skbmod_exit_batch_rtnl,
 	.id   = &act_skbmod_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 1536f8b16f1b250eb62ae5530f01cbc6f7ea632a..6d167a0feed1d5f3d29c06781ffc372743d123be 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -851,14 +851,15 @@ static __net_init int tunnel_key_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_tunnel_key_ops);
 }
 
-static void __net_exit tunnel_key_exit_net(struct list_head *net_list)
+static void __net_exit tunnel_key_exit_batch_rtnl(struct list_head *net_list,
+						  struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_tunnel_key_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_tunnel_key_ops.net_id);
 }
 
 static struct pernet_operations tunnel_key_net_ops = {
 	.init = tunnel_key_init_net,
-	.exit_batch = tunnel_key_exit_net,
+	.exit_batch_rtnl = tunnel_key_exit_batch_rtnl,
 	.id   = &act_tunnel_key_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 22f4b1e8ade9f5a5bb5ece4c2fc600f94d8053fd..6b0ab1750f05b3523d5c96abd2ab7820db57d4a0 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -436,14 +436,15 @@ static __net_init int vlan_init_net(struct net *net)
 	return tc_action_net_init(net, tn, &act_vlan_ops);
 }
 
-static void __net_exit vlan_exit_net(struct list_head *net_list)
+static void __net_exit vlan_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
-	tc_action_net_exit(net_list, act_vlan_ops.net_id);
+	tc_action_net_exit_batch_rtnl(net_list, act_vlan_ops.net_id);
 }
 
 static struct pernet_operations vlan_net_ops = {
 	.init = vlan_init_net,
-	.exit_batch = vlan_exit_net,
+	.exit_batch_rtnl = vlan_exit_batch_rtnl,
 	.id   = &act_vlan_ops.net_id,
 	.size = sizeof(struct tc_action_net),
 };
-- 
2.43.0.594.gd9cf4e227d-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles
  2024-02-08 10:25 [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Eric Dumazet
  2024-02-08 10:25 ` [PATCH net-next 1/2] net/sched: act_api: uninline tc_action_net_init() and tc_action_net_exit() Eric Dumazet
  2024-02-08 10:25 ` [PATCH net-next 2/2] net/sched: act_api: use exit_batch_rtnl() method Eric Dumazet
@ 2024-02-08 22:10 ` Jamal Hadi Salim
  2024-02-09  2:37 ` Jakub Kicinski
  3 siblings, 0 replies; 5+ messages in thread
From: Jamal Hadi Salim @ 2024-02-08 22:10 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Cong Wang,
	Jiri Pirko, netdev, eric.dumazet

On Thu, Feb 8, 2024 at 5:25 AM Eric Dumazet <edumazet@google.com> wrote:
>
> Adopt the new exit_batch_rtnl() method to avoid extra
> rtnl_lock()//rtnl_unlock() pairs.
>

For the patchset:
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

> Eric Dumazet (2):
>   net/sched: act_api: uninline tc_action_net_init() and
>     tc_action_net_exit()
>   net/sched: act_api: use exit_batch_rtnl() method
>
>  include/net/act_api.h      | 34 +++-------------------------------
>  net/sched/act_api.c        | 35 ++++++++++++++++++++++++++++++++---
>  net/sched/act_bpf.c        |  7 ++++---
>  net/sched/act_connmark.c   |  7 ++++---
>  net/sched/act_csum.c       |  7 ++++---
>  net/sched/act_ct.c         |  7 ++++---
>  net/sched/act_ctinfo.c     |  7 ++++---
>  net/sched/act_gact.c       |  7 ++++---
>  net/sched/act_gate.c       |  7 ++++---
>  net/sched/act_ife.c        |  7 ++++---
>  net/sched/act_mirred.c     |  7 ++++---
>  net/sched/act_mpls.c       |  7 ++++---
>  net/sched/act_nat.c        |  7 ++++---
>  net/sched/act_pedit.c      |  7 ++++---
>  net/sched/act_police.c     |  7 ++++---
>  net/sched/act_sample.c     |  7 ++++---
>  net/sched/act_simple.c     |  7 ++++---
>  net/sched/act_skbedit.c    |  7 ++++---
>  net/sched/act_skbmod.c     |  7 ++++---
>  net/sched/act_tunnel_key.c |  7 ++++---
>  net/sched/act_vlan.c       |  7 ++++---
>  21 files changed, 111 insertions(+), 91 deletions(-)
>
> --
> 2.43.0.594.gd9cf4e227d-goog
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles
  2024-02-08 10:25 [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Eric Dumazet
                   ` (2 preceding siblings ...)
  2024-02-08 22:10 ` [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Jamal Hadi Salim
@ 2024-02-09  2:37 ` Jakub Kicinski
  3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-02-09  2:37 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Paolo Abeni, Jamal Hadi Salim, Cong Wang,
	Jiri Pirko, netdev, eric.dumazet

On Thu,  8 Feb 2024 10:25:06 +0000 Eric Dumazet wrote:
> Adopt the new exit_batch_rtnl() method to avoid extra
> rtnl_lock()//rtnl_unlock() pairs.

Hi Eric! I think these were exploding selftests:

https://netdev.bots.linux.dev/contest.html?branch=net-next-2024-02-08--18-00&executor=vmksft-net&pw-n=0&pass=0

not 100% sure, but they fit the bill, and once I dropped them the next
branch went thru cleanly.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-09  2:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 10:25 [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Eric Dumazet
2024-02-08 10:25 ` [PATCH net-next 1/2] net/sched: act_api: uninline tc_action_net_init() and tc_action_net_exit() Eric Dumazet
2024-02-08 10:25 ` [PATCH net-next 2/2] net/sched: act_api: use exit_batch_rtnl() method Eric Dumazet
2024-02-08 22:10 ` [PATCH net-next 0/2] net/sched: act_api: speed up netns dismantles Jamal Hadi Salim
2024-02-09  2:37 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).