diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-02-07 18:55:15 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-07 18:55:16 -0800 |
commit | b6b614558ed5b2ca50edacc0f2fbf5f52158c86c (patch) | |
tree | f7dcd82263393d8c8dee032a7f6926cd43f9a045 /include | |
parent | a1e55f51035e6aa65cf2d11d2147f2bf9edf81f9 (diff) | |
parent | 8962daccc2d32812fe24bd21496c036eb4f454b0 (diff) |
Merge branch 'net-more-factorization-in-cleanup_net-paths'
Eric Dumazet says:
====================
net: more factorization in cleanup_net() paths
This series is inspired by recent syzbot reports hinting to RTNL and
workqueue abuses.
rtnl_lock() is unfair to (single threaded) cleanup_net(), because
many threads can cause contention on it.
This series adds a new (struct pernet_operations) method,
so that cleanup_net() can hold RTNL longer once it finally
acquires it.
It also factorizes unregister_netdevice_many(), to further
reduce stalls in cleanup_net().
Link: https://lore.kernel.org/netdev/CANn89iLJrrJs+6Vc==Un4rVKcpV0Eof4F_4w1_wQGxUCE2FWAg@mail.gmail.com/T/#u
https://lore.kernel.org/netdev/170688415193.5216.10499830272732622816@kwain/
====================
Link: https://lore.kernel.org/r/20240206144313.2050392-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ip_tunnels.h | 3 | ||||
-rw-r--r-- | include/net/net_namespace.h | 3 | ||||
-rw-r--r-- | include/net/nexthop.h | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 2d746f4c9a0a..5cd64bb2104d 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -284,7 +284,8 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, struct rtnl_link_ops *ops, char *devname); void ip_tunnel_delete_nets(struct list_head *list_net, unsigned int id, - struct rtnl_link_ops *ops); + struct rtnl_link_ops *ops, + struct list_head *dev_to_kill); void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, const struct iphdr *tnl_params, const u8 protocol); 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; }; diff --git a/include/net/nexthop.h b/include/net/nexthop.h index d92046a4a078..6647ad509faa 100644 --- a/include/net/nexthop.h +++ b/include/net/nexthop.h @@ -218,6 +218,7 @@ struct nh_notifier_info { int register_nexthop_notifier(struct net *net, struct notifier_block *nb, struct netlink_ext_ack *extack); +int __unregister_nexthop_notifier(struct net *net, struct notifier_block *nb); int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb); void nexthop_set_hw_flags(struct net *net, u32 id, bool offload, bool trap); void nexthop_bucket_set_hw_flags(struct net *net, u32 id, u16 bucket_index, |