diff options
author | Kirill Tkhai <ktkhai@virtuozzo.com> | 2018-02-19 10:58:38 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-20 19:23:13 +0100 |
commit | 19efbd93e6fb05eab81856b4fc8d64211dd37088 (patch) | |
tree | 92b753425011641fc730a1eda732169350ad6ffd /include/net/net_namespace.h | |
parent | ibmvnic: Keep track of supplementary TX descriptors (diff) | |
download | linux-19efbd93e6fb05eab81856b4fc8d64211dd37088.tar.xz linux-19efbd93e6fb05eab81856b4fc8d64211dd37088.zip |
net: Kill net_mutex
We take net_mutex, when there are !async pernet_operations
registered, and read locking of net_sem is not enough. But
we may get rid of taking the mutex, and just change the logic
to write lock net_sem in such cases. This obviously reduces
the number of lock operations, we do.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r-- | include/net/net_namespace.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 9158ec1ad06f..115b01b92f4d 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -60,8 +60,11 @@ struct net { struct list_head list; /* list of network namespaces */ struct list_head cleanup_list; /* namespaces on death row */ - struct list_head exit_list; /* Use only net_mutex */ - + struct list_head exit_list; /* To linked to call pernet exit + * methods on dead net (net_sem + * read locked), or to unregister + * pernet ops (net_sem wr locked). + */ struct user_namespace *user_ns; /* Owning user namespace */ struct ucounts *ucounts; spinlock_t nsid_lock; @@ -89,7 +92,7 @@ struct net { /* core fib_rules */ struct list_head rules_ops; - struct list_head fib_notifier_ops; /* protected by net_mutex */ + struct list_head fib_notifier_ops; /* protected by net_sem */ struct net_device *loopback_dev; /* The loopback */ struct netns_core core; @@ -316,7 +319,7 @@ struct pernet_operations { /* * Indicates above methods are allowed to be executed in parallel * with methods of any other pernet_operations, i.e. they are not - * need synchronization via net_mutex. + * need write locked net_sem. */ bool async; }; |