aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>2016-12-28 04:52:33 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-29 11:38:31 -0500
commitfee83d097b1620530f23bf6063f4ea251ba9c8c7 (patch)
tree64c2ff87e756a8e024308d7d9f076ae282d9c83f /net/ipv4/tcp_ipv4.c
parent1946e672c173559155a3e210fe95dbf8b7b8ddf7 (diff)
ipv4: Namespaceify tcp_max_syn_backlog knob
Different namespace application might require different maximal number of remembered connection requests. Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 56b5f49e3f97..7e4be4f361f3 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2419,7 +2419,7 @@ static void __net_exit tcp_sk_exit(struct net *net)
2419 2419
2420static int __net_init tcp_sk_init(struct net *net) 2420static int __net_init tcp_sk_init(struct net *net)
2421{ 2421{
2422 int res, cpu; 2422 int res, cpu, cnt;
2423 2423
2424 net->ipv4.tcp_sk = alloc_percpu(struct sock *); 2424 net->ipv4.tcp_sk = alloc_percpu(struct sock *);
2425 if (!net->ipv4.tcp_sk) 2425 if (!net->ipv4.tcp_sk)
@@ -2458,10 +2458,13 @@ static int __net_init tcp_sk_init(struct net *net)
2458 net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; 2458 net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
2459 net->ipv4.sysctl_tcp_tw_reuse = 0; 2459 net->ipv4.sysctl_tcp_tw_reuse = 0;
2460 2460
2461 cnt = tcp_hashinfo.ehash_mask + 1;
2461 net->ipv4.tcp_death_row.sysctl_tw_recycle = 0; 2462 net->ipv4.tcp_death_row.sysctl_tw_recycle = 0;
2462 net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (tcp_hashinfo.ehash_mask + 1) / 2; 2463 net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (cnt + 1) / 2;
2463 net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; 2464 net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;
2464 2465
2466 net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);
2467
2465 return 0; 2468 return 0;
2466fail: 2469fail:
2467 tcp_sk_exit(net); 2470 tcp_sk_exit(net);