Kirill Tkhai
f0b07bb151
net: Introduce net_rwsem to protect net_namespace_list
...
rtnl_lock() is used everywhere, and contention is very high.
When someone wants to iterate over alive net namespaces,
he/she has no a possibility to do that without exclusive lock.
But the exclusive rtnl_lock() in such places is overkill,
and it just increases the contention. Yes, there is already
for_each_net_rcu() in kernel, but it requires rcu_read_lock(),
and this can't be sleepable. Also, sometimes it may be need
really prevent net_namespace_list growth, so for_each_net_rcu()
is not fit there.
This patch introduces new rw_semaphore, which will be used
instead of rtnl_mutex to protect net_namespace_list. It is
sleepable and allows not-exclusive iterations over net
namespaces list. It allows to stop using rtnl_lock()
in several places (what is made in next patches) and makes
less the time, we keep rtnl_mutex. Here we just add new lock,
while the explanation of we can remove rtnl_lock() there are
in next patches.
Fine grained locks generally are better, then one big lock,
so let's do that with net_namespace_list, while the situation
allows that.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
2018-03-29 13:47:53 -04:00
..
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-02-02 13:21:48 +01:00
2018-01-08 18:11:10 +01:00
2018-01-19 14:02:18 +01:00
2017-04-26 09:30:22 +02:00
2017-06-19 19:13:21 +02:00
2017-07-24 13:24:46 +02:00
2018-03-29 13:47:53 -04:00
2017-04-26 09:30:22 +02:00
2018-01-19 14:10:53 +01:00
2017-09-04 13:25:19 +02:00
2017-04-19 17:55:17 +02:00
2018-01-08 18:01:05 +01:00
2018-01-08 18:01:26 +01:00
2017-07-31 19:09:38 +02:00
2017-04-19 17:55:17 +02:00
2017-08-24 18:52:32 +02:00
2017-04-26 09:30:22 +02:00
2018-03-26 12:07:48 -04:00
2018-03-27 13:18:09 -04:00
2017-07-24 13:24:46 +02:00
2018-01-08 18:00:54 +01:00
2018-01-08 18:01:02 +01:00
2018-03-27 13:18:09 -04:00
2018-01-08 18:01:02 +01:00
2018-01-08 18:11:05 +01:00
2018-01-08 18:01:02 +01:00
2018-01-08 16:47:14 +01:00
2017-04-19 17:55:17 +02:00
2017-04-26 09:30:22 +02:00
2017-07-24 13:24:46 +02:00
2018-03-26 12:07:48 -04:00
2018-03-27 13:18:09 -04:00
2017-04-19 17:55:17 +02:00
2017-04-26 09:30:22 +02:00
2017-04-26 09:30:22 +02:00
2017-05-29 11:32:36 +02:00
2018-02-07 00:58:57 +01:00
2018-02-07 11:55:52 +01:00
2018-01-08 18:01:06 +01:00
2016-12-04 20:45:33 +01:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2017-04-06 22:01:38 +02:00
2017-10-24 17:54:47 +02:00
2017-10-31 15:30:37 +01:00
2017-04-06 22:01:38 +02:00
2017-10-31 15:30:37 +01:00
2018-02-14 21:05:40 +01:00
2016-12-04 20:45:30 +01:00
2017-07-01 09:08:41 -07:00
2015-08-17 21:33:06 -07:00
2017-01-03 14:33:25 +01:00
2017-09-04 13:25:19 +02:00
2018-01-10 15:32:15 +01:00
2017-11-02 11:10:55 +01:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2017-08-02 14:25:59 +02:00
2018-01-10 15:32:11 +01:00
2018-01-10 15:32:11 +01:00
2017-07-31 20:41:57 +02:00
2018-03-27 13:18:09 -04:00
2017-12-04 11:30:09 +01:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2017-05-15 12:51:41 +02:00
2016-11-09 23:42:23 +01:00
2018-01-08 18:01:01 +01:00
2018-01-19 18:39:49 +01:00
2017-09-04 13:25:09 +02:00
2018-01-10 15:32:08 +01:00
2016-01-03 21:04:23 +01:00
2018-01-19 14:10:04 +01:00
2017-12-11 13:46:04 +01:00
2016-11-03 11:52:34 +01:00
2017-07-31 19:01:40 +02:00
2017-03-13 13:45:36 +01:00
2018-02-07 00:58:57 +01:00
2016-12-06 21:48:22 +01:00
2017-05-01 10:47:53 -04:00
2017-05-15 12:51:41 +02:00
2017-09-04 13:25:16 +02:00
2018-01-10 15:32:08 +01:00
2017-03-06 18:23:23 +01:00
2018-01-10 15:32:08 +01:00
2018-01-10 15:32:08 +01:00
2018-01-10 15:32:08 +01:00
2017-04-07 18:24:47 +02:00
2017-09-04 13:25:09 +02:00
2017-08-28 17:42:56 +02:00
2017-04-07 18:24:47 +02:00
2017-09-04 13:25:09 +02:00
2017-05-15 12:51:41 +02:00
2018-01-10 15:32:08 +01:00
2017-03-06 18:22:12 +01:00
2017-03-06 18:22:12 +01:00
2018-01-08 18:01:26 +01:00
2017-11-07 01:00:31 +01:00
2018-03-06 12:23:33 +01:00
2017-11-07 01:00:31 +01:00
2018-01-08 18:10:53 +01:00
2018-03-27 13:18:09 -04:00
2018-02-14 21:05:37 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-01-08 18:01:22 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:34 +01:00
2016-11-03 10:56:21 +01:00
2018-02-14 21:05:33 +01:00
2018-02-14 21:05:33 +01:00
2018-02-14 21:05:38 +01:00
2018-03-27 13:18:09 -04:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:33 +01:00
2018-02-14 21:05:37 +01:00
2018-03-26 12:07:48 -04:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:39 +01:00
2018-02-14 21:05:38 +01:00
2016-11-03 10:56:21 +01:00
2016-12-06 21:48:20 +01:00
2018-02-14 21:05:38 +01:00
2017-09-04 13:25:19 +02:00
2018-02-14 21:05:38 +01:00
2016-11-03 10:56:21 +01:00
2018-02-14 21:05:35 +01:00
2017-12-06 09:01:18 +01:00
2017-03-02 08:42:31 +01:00
2018-02-14 21:05:38 +01:00
2017-01-18 20:32:43 +01:00
2018-02-14 21:05:37 +01:00
2017-01-09 17:24:55 +01:00
2017-01-09 17:24:55 +01:00
2018-02-07 00:58:57 +01:00
2018-03-27 13:18:09 -04:00
2016-12-04 21:16:51 +01:00
2017-11-02 11:10:55 +01:00
2017-07-01 09:08:41 -07:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:35 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2018-01-31 14:59:24 +01:00
2017-01-09 17:24:55 +01:00
2018-02-14 21:05:38 +01:00
2015-08-17 21:33:06 -07:00
2016-07-03 10:55:07 +02:00
2017-01-09 17:24:55 +01:00
2018-02-14 21:05:38 +01:00
2018-02-14 21:05:38 +01:00
2016-06-23 13:26:49 +02:00