All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: Antoine Tenart <atenart@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	 Eric Dumazet <edumazet@google.com>
Subject: [PATCH v4 net-next 12/15] sit: use exit_batch_rtnl() method
Date: Tue,  6 Feb 2024 14:43:09 +0000	[thread overview]
Message-ID: <20240206144313.2050392-14-edumazet@google.com> (raw)
In-Reply-To: <20240206144313.2050392-1-edumazet@google.com>

exit_batch_rtnl() is called while RTNL is held,
and devices to be unregistered can be queued in the dev_kill_list.

This saves one rtnl_lock()/rtnl_unlock() pair
and one unregister_netdevice_many() call.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/sit.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index cc24cefdb85c0944c03c019b1c4214302d18e2c8..61b2b71fa8bedea6d185348ff781356652434b33 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1875,22 +1875,19 @@ static int __net_init sit_init_net(struct net *net)
 	return err;
 }
 
-static void __net_exit sit_exit_batch_net(struct list_head *net_list)
+static void __net_exit sit_exit_batch_rtnl(struct list_head *net_list,
+					   struct list_head *dev_to_kill)
 {
-	LIST_HEAD(list);
 	struct net *net;
 
-	rtnl_lock();
+	ASSERT_RTNL();
 	list_for_each_entry(net, net_list, exit_list)
-		sit_destroy_tunnels(net, &list);
-
-	unregister_netdevice_many(&list);
-	rtnl_unlock();
+		sit_destroy_tunnels(net, dev_to_kill);
 }
 
 static struct pernet_operations sit_net_ops = {
 	.init = sit_init_net,
-	.exit_batch = sit_exit_batch_net,
+	.exit_batch_rtnl = sit_exit_batch_rtnl,
 	.id   = &sit_net_id,
 	.size = sizeof(struct sit_net),
 };
-- 
2.43.0.594.gd9cf4e227d-goog


  parent reply	other threads:[~2024-02-06 14:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 14:42 [PATCH v4 net-next 00/15] net: more factorization in cleanup_net() paths Eric Dumazet
2024-02-06 14:42 ` [PATCH v4 net-next 01/15] net: add exit_batch_rtnl() method Eric Dumazet
2024-02-06 14:42 ` [PATCH net] ppp_async: limit MRU to 64K Eric Dumazet
2024-02-06 16:50   ` Eric Dumazet
2024-02-07  3:00   ` patchwork-bot+netdevbpf
2024-02-06 14:42 ` [PATCH v4 net-next 02/15] nexthop: convert nexthop_net_exit_batch to exit_batch_rtnl method Eric Dumazet
2024-02-07 17:57   ` David Ahern
2024-02-06 14:43 ` [PATCH v4 net-next 03/15] bareudp: use exit_batch_rtnl() method Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 04/15] bonding: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 05/15] geneve: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 06/15] gtp: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 07/15] ipv4: add __unregister_nexthop_notifier() Eric Dumazet
2024-02-07 18:06   ` David Ahern
2024-02-06 14:43 ` [PATCH v4 net-next 08/15] vxlan: use exit_batch_rtnl() method Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 09/15] ip6_gre: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 10/15] ip6_tunnel: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 11/15] ip6_vti: " Eric Dumazet
2024-02-06 14:43 ` Eric Dumazet [this message]
2024-02-06 14:43 ` [PATCH v4 net-next 13/15] ip_tunnel: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 14/15] bridge: " Eric Dumazet
2024-02-06 14:43 ` [PATCH v4 net-next 15/15] xfrm: interface: " Eric Dumazet
2024-02-07 10:27 ` [PATCH v4 net-next 00/15] net: more factorization in cleanup_net() paths Antoine Tenart
2024-02-08  3:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240206144313.2050392-14-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.