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

Submitted by Kirill Tkhai on Dec. 4, 2016, 12:14 p.m.

Details

Message ID 148085362769.6846.13015672197897878932.stgit@localhost.localdomain
State New
Series "net: Do not initialize netns_ct::can_alloc"
Headers show

Commit Message

Kirill Tkhai Dec. 4, 2016, 12:14 p.m.
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@virtuozzo.com>
---
 include/net/netns/conntrack.h     |    2 +-
 net/netfilter/nf_conntrack_core.c |    1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);