* [PATCH net-next] net: Add comment about pernet_operations methods and synchronization
@ 2018-03-13 10:55 Kirill Tkhai
2018-03-13 15:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kirill Tkhai @ 2018-03-13 10:55 UTC (permalink / raw)
To: davem, ktkhai, netdev
Make locking scheme be visible for users, and provide
a comment what for we are need exit_batch() methods,
and when it should be used.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
include/net/net_namespace.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index d4417495773a..71abc8d79178 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -312,6 +312,20 @@ struct net *get_net_ns_by_id(struct net *net, int id);
struct pernet_operations {
struct list_head list;
+ /*
+ * Below methods are called without any exclusive locks.
+ * More than one net may be constructed and destructed
+ * in parallel on several cpus. Every pernet_operations
+ * have to keep in mind all other pernet_operations and
+ * to introduce a locking, if they share common resources.
+ *
+ * Exit methods using blocking RCU primitives, such as
+ * synchronize_rcu(), should be implemented via exit_batch.
+ * Then, destruction of a group of net requires single
+ * synchronize_rcu() related to these pernet_operations,
+ * instead of separate synchronize_rcu() for every net.
+ * Please, avoid synchronize_rcu() at all, where it's possible.
+ */
int (*init)(struct net *net);
void (*exit)(struct net *net);
void (*exit_batch)(struct list_head *net_exit_list);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: Add comment about pernet_operations methods and synchronization
2018-03-13 10:55 [PATCH net-next] net: Add comment about pernet_operations methods and synchronization Kirill Tkhai
@ 2018-03-13 15:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-13 15:31 UTC (permalink / raw)
To: ktkhai; +Cc: netdev
From: Kirill Tkhai <ktkhai@virtuozzo.com>
Date: Tue, 13 Mar 2018 13:55:55 +0300
> Make locking scheme be visible for users, and provide
> a comment what for we are need exit_batch() methods,
> and when it should be used.
>
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-13 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 10:55 [PATCH net-next] net: Add comment about pernet_operations methods and synchronization Kirill Tkhai
2018-03-13 15:31 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).