[Devel] [PATCH] net: Do not initialize netns_ct::can_alloc

Kirill Tkhai ktkhai at virtuozzo.com
Sun Dec 4 04:14:04 PST 2016


It's already initialized to zero during net creation
in net_alloc(), so do not do that twice.

Also, some conntrack allowing modules do not depend
on nf_conntrack.ko, so it rewrites can_alloc to zero,
if it's loaded later.

(This may be merged with "commit af2b974e4755 "net: Primitives to enable conntrack allocation")

https://jira.sw.ru/browse/PSBM-56500

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/net/netns/conntrack.h     |    2 +-
 net/netfilter/nf_conntrack_core.c |    1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 0c2a685..31596df 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -74,7 +74,7 @@ struct ct_pcpu {
 
 struct netns_ct {
 	atomic_t		count;
-	bool			can_alloc;
+	bool			can_alloc; /* Initialized in 0 by net_alloc */
 	unsigned int		max;
 	unsigned int		expect_count;
 	unsigned int		expect_max;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index d5a283a..8fca77e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1823,7 +1823,6 @@ int nf_conntrack_init_net(struct net *net)
 	int cpu;
 
 	atomic_set(&net->ct.count, 0);
-	net->ct.can_alloc = false;
 	net->ct.max = init_net.ct.max;
 	seqcount_init(&net->ct.generation);
 



More information about the Devel mailing list