summaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2018-02-19 12:58:38 +0300
committerDavid S. Miller <davem@davemloft.net>2018-02-20 13:23:13 -0500
commit19efbd93e6fb05eab81856b4fc8d64211dd37088 (patch)
tree92b753425011641fc730a1eda732169350ad6ffd /include/net/net_namespace.h
parentffc385b95adb0e601f6858b06401adabedf59f81 (diff)
downloadop-kernel-dev-19efbd93e6fb05eab81856b4fc8d64211dd37088.zip
op-kernel-dev-19efbd93e6fb05eab81856b4fc8d64211dd37088.tar.gz
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.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 9158ec1..115b01b 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;
};
OpenPOWER on IntegriCloud