netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev <netdev@vger.kernel.org>, David Ahern <dsahern@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH v2 net-next 04/11] nexthop: change nexthop_net_exit() to nexthop_net_exit_batch()
Date: Mon,  7 Feb 2022 20:50:31 -0800	[thread overview]
Message-ID: <20220208045038.2635826-5-eric.dumazet@gmail.com> (raw)
In-Reply-To: <20220208045038.2635826-1-eric.dumazet@gmail.com>

From: Eric Dumazet <edumazet@google.com>

cleanup_net() is competing with other rtnl users.

nexthop_net_exit() seems a good candidate for exit_batch(),
as this gives chance for cleanup_net() to progress much faster,
holding rtnl a bit longer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
---
 net/ipv4/nexthop.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index eeafeccebb8d44629085f504e26cb4e171c8c782..e459a391e607d34e16828bef13a5ce22ba6dde89 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -3733,12 +3733,16 @@ void nexthop_res_grp_activity_update(struct net *net, u32 id, u16 num_buckets,
 }
 EXPORT_SYMBOL(nexthop_res_grp_activity_update);
 
-static void __net_exit nexthop_net_exit(struct net *net)
+static void __net_exit nexthop_net_exit_batch(struct list_head *net_list)
 {
+	struct net *net;
+
 	rtnl_lock();
-	flush_all_nexthops(net);
+	list_for_each_entry(net, net_list, exit_list) {
+		flush_all_nexthops(net);
+		kfree(net->nexthop.devhash);
+	}
 	rtnl_unlock();
-	kfree(net->nexthop.devhash);
 }
 
 static int __net_init nexthop_net_init(struct net *net)
@@ -3756,7 +3760,7 @@ static int __net_init nexthop_net_init(struct net *net)
 
 static struct pernet_operations nexthop_net_ops = {
 	.init = nexthop_net_init,
-	.exit = nexthop_net_exit,
+	.exit_batch = nexthop_net_exit_batch,
 };
 
 static int __init nexthop_init(void)
-- 
2.35.0.263.gb82422642f-goog


  parent reply	other threads:[~2022-02-08  5:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08  4:50 [PATCH v2 net-next 00/11] net: speedup netns dismantles Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 01/11] ipv6/addrconf: allocate a per netns hash table Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 02/11] ipv6/addrconf: use one delayed work per netns Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 03/11] ipv6/addrconf: switch to per netns inet6_addr_lst hash table Eric Dumazet
2022-02-08  4:50 ` Eric Dumazet [this message]
2022-02-08  4:50 ` [PATCH v2 net-next 05/11] ipv4: add fib_net_exit_batch() Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 06/11] ipv6: change fib6_rules_net_exit() to batch mode Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 07/11] ip6mr: introduce ip6mr_net_exit_batch() Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 08/11] ipmr: introduce ipmr_net_exit_batch() Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 09/11] can: gw: switch cangw_pernet_exit() to batch mode Eric Dumazet
2022-02-08  8:10   ` Marc Kleine-Budde
2022-02-08  4:50 ` [PATCH v2 net-next 10/11] bonding: switch bond_net_exit() " Eric Dumazet
2022-02-08  4:50 ` [PATCH v2 net-next 11/11] net: remove default_device_exit() Eric Dumazet
2022-02-09  5:20 ` [PATCH v2 net-next 00/11] net: speedup netns dismantles 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=20220208045038.2635826-5-eric.dumazet@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 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).