netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bridge: switch br_net_exit to batch mode
@ 2022-02-18  7:01 Eric Dumazet
  2022-02-18  8:19 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2022-02-18  7:01 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Roopa Prabhu, Nikolay Aleksandrov

From: Eric Dumazet <edumazet@google.com>

cleanup_net() is competing with other rtnl users.

Instead of calling br_net_exit() for each netns,
call br_net_exit_batch() once.

This gives cleanup_net() ability to group more devices
and call unregister_netdevice_many() only once for all bridge devices.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Roopa Prabhu <roopa@nvidia.com>
Cc: Nikolay Aleksandrov <razor@blackwall.org>
---
 net/bridge/br.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/bridge/br.c b/net/bridge/br.c
index 1fac72cc617ff7e1851b715860a95e9a1247b9b1..b1dea3febeea49f4e0882a1df64e09fc1db6b3b4 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -342,23 +342,26 @@ void br_opt_toggle(struct net_bridge *br, enum net_bridge_opts opt, bool on)
 		clear_bit(opt, &br->options);
 }
 
-static void __net_exit br_net_exit(struct net *net)
+static void __net_exit br_net_exit_batch(struct list_head *net_list)
 {
 	struct net_device *dev;
+	struct net *net;
 	LIST_HEAD(list);
 
 	rtnl_lock();
-	for_each_netdev(net, dev)
-		if (netif_is_bridge_master(dev))
-			br_dev_delete(dev, &list);
+
+	list_for_each_entry(net, net_list, exit_list)
+		for_each_netdev(net, dev)
+			if (netif_is_bridge_master(dev))
+				br_dev_delete(dev, &list);
 
 	unregister_netdevice_many(&list);
+
 	rtnl_unlock();
-
 }
 
 static struct pernet_operations br_net_ops = {
-	.exit	= br_net_exit,
+	.exit_batch	= br_net_exit_batch,
 };
 
 static const struct stp_proto br_stp_proto = {
-- 
2.35.1.265.g69c8d7142f-goog


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

* Re: [PATCH net-next] bridge: switch br_net_exit to batch mode
  2022-02-18  7:01 [PATCH net-next] bridge: switch br_net_exit to batch mode Eric Dumazet
@ 2022-02-18  8:19 ` Nikolay Aleksandrov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Aleksandrov @ 2022-02-18  8:19 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Roopa Prabhu

On 18/02/2022 09:01, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> cleanup_net() is competing with other rtnl users.
> 
> Instead of calling br_net_exit() for each netns,
> call br_net_exit_batch() once.
> 
> This gives cleanup_net() ability to group more devices
> and call unregister_netdevice_many() only once for all bridge devices.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Roopa Prabhu <roopa@nvidia.com>
> Cc: Nikolay Aleksandrov <razor@blackwall.org>
> ---
>  net/bridge/br.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 

Thanks,
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>


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

end of thread, other threads:[~2022-02-18  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  7:01 [PATCH net-next] bridge: switch br_net_exit to batch mode Eric Dumazet
2022-02-18  8:19 ` Nikolay Aleksandrov

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).