summaryrefslogtreecommitdiff
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-02-06 17:42:57 +0300
committerJakub Kicinski <kuba@kernel.org>2024-02-08 05:55:10 +0300
commitfd4f101edbd9f99567ab2adb1f2169579ede7c13 (patch)
treef4d21576ed8597e55777862a4dad7217436b06cc /include/net/net_namespace.h
parenta1e55f51035e6aa65cf2d11d2147f2bf9edf81f9 (diff)
downloadlinux-fd4f101edbd9f99567ab2adb1f2169579ede7c13.tar.xz
net: add exit_batch_rtnl() method
Many (struct pernet_operations)->exit_batch() methods have to acquire rtnl. In presence of rtnl mutex pressure, this makes cleanup_net() very slow. This patch adds a new exit_batch_rtnl() method to reduce number of rtnl acquisitions from cleanup_net(). exit_batch_rtnl() handlers are called while rtnl is locked, and devices to be killed can be queued in a list provided as their second argument. A single unregister_netdevice_many() is called right before rtnl is released. exit_batch_rtnl() handlers are called before ->exit() and ->exit_batch() handlers. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Antoine Tenart <atenart@kernel.org> Link: https://lore.kernel.org/r/20240206144313.2050392-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index cd0c2eedbb5e..20c34bd7a077 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -448,6 +448,9 @@ struct pernet_operations {
void (*pre_exit)(struct net *net);
void (*exit)(struct net *net);
void (*exit_batch)(struct list_head *net_exit_list);
+ /* Following method is called with RTNL held. */
+ void (*exit_batch_rtnl)(struct list_head *net_exit_list,
+ struct list_head *dev_kill_list);
unsigned int *id;
size_t size;
};