[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250107173838.1130187-5-edumazet@google.com>
Date: Tue, 7 Jan 2025 17:38:38 +0000
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, Simon Horman <horms@...nel.org>, eric.dumazet@...il.com,
Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH net-next 4/4] net: reduce RTNL hold duration in unregister_netdevice_many_notify()
Two synchronize_net() calls are currently done while holding RTNL.
This is source of RTNL contention in workloads adding and deleting
many network namespaces per second, because synchronize_rcu()
and synchronize_rcu_expedited() can use 10+ ms in some cases.
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
net/core/dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 342ab7d6001da8983db450f50327fc7915b0a8ba..9e93b13b9a76bd256d93d05a13d21dca883d6ab8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11529,8 +11529,8 @@ void unregister_netdevice_many_notify(struct list_head *head,
__rtnl_unlock();
flush_all_backlogs();
- rtnl_lock();
synchronize_net();
+ rtnl_lock();
list_for_each_entry(dev, head, unreg_list) {
struct sk_buff *skb = NULL;
@@ -11590,7 +11590,9 @@ void unregister_netdevice_many_notify(struct list_head *head,
#endif
}
+ __rtnl_unlock();
synchronize_net();
+ rtnl_lock();
list_for_each_entry(dev, head, unreg_list) {
netdev_put(dev, &dev->dev_registered_tracker);
--
2.47.1.613.gc27f4b7a9f-goog
Powered by blists - more mailing lists