All of lore.kernel.org
 help / color / mirror / Atom feed
* [v3.3-rc1 regression] TCP: too many of orphaned sockets
@ 2012-01-27 12:46 Ingo Molnar
  2012-01-27 12:49 ` Glauber Costa
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-27 12:46 UTC (permalink / raw)
  To: netdev, David S. Miller; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 2104 bytes --]


There's a new TCP regression in latest -git that triggers in 
randconfig testing.

With the attached config i'm getting tons of these messages:

[   32.751209] TCP: too many of orphaned sockets                                                   
[   37.198307] TCP: too many of orphaned sockets                                                   
[   42.464404] TCP: too many of orphaned sockets                                                   
[   48.920392] TCP: too many of orphaned sockets                                                   
[   56.370026] TCP: too many of orphaned sockets                                                   
[   64.605937] TCP: too many of orphaned sockets                     

and it's not possible to ssh into the testbox, the TCP 
connection hangs.

Before i put more effort into debugging this, is this bug 
already known/fixed?

NOTE: the .config is randconfig generated so it might have a few 
weird combinations of config options. One such thing i noticed 
is !CONFIG_BUG, this produces at least one of the following 
build warnings in the networking code:

net/core/ethtool.c:211:1: warning: control reaches end of non-void function [-Wreturn-type]
net/core/dev.c:1892:33: warning: unused variable ‘null_features’ [-Wunused-variable]
net/packet/af_packet.c:1878:30: warning: ‘hdrlen’ may be used uninitialized in this function [-Wmaybe-uninitialized]
net/xfrm/xfrm_policy.c:2456:17: warning: ‘xfrm_dst_ops’ may be used uninitialized in this function [-Wmaybe-uninitialized]
net/xfrm/xfrm_policy.c:1351:7: warning: ‘dst_ops’ may be used uninitialized in this function [-Wmaybe-uninitialized]
net/xfrm/xfrm_policy.c:1333:18: note: ‘dst_ops’ was declared here
net/xfrm/xfrm_policy.c:1351:7: warning: ‘dst_ops’ may be used uninitialized in this function [-Wmaybe-uninitialized]
net/xfrm/xfrm_policy.c:1333:18: note: ‘dst_ops’ was declared here

Note#2, the message should probably be fixed as well:

 -   TCP: too many of orphaned sockets                     
 +   TCP: too many orphaned sockets                     

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] net/tcp: Fix tcp memory limits initialization when !CONFIG_SYSCTL
@ 2012-01-30 11:20 Glauber Costa
  2012-01-30 17:41 ` David Miller
  0 siblings, 1 reply; 14+ messages in thread
From: Glauber Costa @ 2012-01-30 11:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, Glauber Costa, Ingo Molnar

sysctl_tcp_mem() initialization was moved to sysctl_tcp_ipv4.c
in commit 3dc43e3e4d0b52197d3205214fe8f162f9e0c334, since it
became a per-ns value.

That code, however, will never run when CONFIG_SYSCTL is
disabled, leading to bogus values on those fields - causing hung
TCP sockets.

This patch fixes it by keeping an initialization code in
tcp_init(). It will be overwritten by the first net namespace
init if CONFIG_SYSCTL is compiled in, and do the right thing if
it is compiled out.

It is also named properly as tcp_init_mem(), to properly signal
its non-sysctl side effect on TCP limits.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: David S. Miller <davem@davemloft.net>
Link: http://lkml.kernel.org/r/4F22D05A.8030604@parallels.com
[ renamed the function, tidied up the changelog a bit ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/net/tcp.h          |    2 ++
 net/ipv4/sysctl_net_ipv4.c |    1 +
 net/ipv4/tcp.c             |   16 +++++++++++++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0118ea9..d49db01 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -311,6 +311,8 @@ extern struct proto tcp_prot;
 #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
 #define TCP_ADD_STATS(net, field, val)	SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
 
+extern void tcp_init_mem(struct net *net);
+
 extern void tcp_v4_err(struct sk_buff *skb, u32);
 
 extern void tcp_shutdown (struct sock *sk, int how);
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 4aa7e9d..4cb9cd2 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -814,6 +814,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
 
 	net->ipv4.sysctl_rt_cache_rebuild_count = 4;
 
+	tcp_init_mem(net);
 	limit = nr_free_buffer_pages() / 8;
 	limit = max(limit, 128UL);
 	net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 9bcdec3..06373b4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3216,6 +3216,16 @@ static int __init set_thash_entries(char *str)
 }
 __setup("thash_entries=", set_thash_entries);
 
+void tcp_init_mem(struct net *net)
+{
+	/* Set per-socket limits to no more than 1/128 the pressure threshold */
+	unsigned long limit = nr_free_buffer_pages() / 8;
+	limit = max(limit, 128UL);
+	net->ipv4.sysctl_tcp_mem[0] = limit / 4 * 3;
+	net->ipv4.sysctl_tcp_mem[1] = limit;
+	net->ipv4.sysctl_tcp_mem[2] = net->ipv4.sysctl_tcp_mem[0] * 2;
+}
+
 void __init tcp_init(void)
 {
 	struct sk_buff *skb = NULL;
@@ -3276,9 +3286,9 @@ void __init tcp_init(void)
 	sysctl_tcp_max_orphans = cnt / 2;
 	sysctl_max_syn_backlog = max(128, cnt / 256);
 
-	/* Set per-socket limits to no more than 1/128 the pressure threshold */
-	limit = ((unsigned long)init_net.ipv4.sysctl_tcp_mem[1])
-		<< (PAGE_SHIFT - 7);
+	tcp_init_mem(&init_net);
+	limit = nr_free_buffer_pages() / 8;
+	limit = max(limit, 128UL);
 	max_share = min(4UL*1024*1024, limit);
 
 	sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-01-30 17:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-27 12:46 [v3.3-rc1 regression] TCP: too many of orphaned sockets Ingo Molnar
2012-01-27 12:49 ` Glauber Costa
2012-01-27 12:56   ` Ingo Molnar
2012-01-27 14:17     ` Ingo Molnar
2012-01-27 14:22       ` Ingo Molnar
2012-01-27 14:28         ` Glauber Costa
2012-01-27 14:35         ` Glauber Costa
2012-01-27 16:27           ` Glauber Costa
2012-01-27 21:28             ` David Miller
2012-01-27 21:28               ` Glauber Costa
2012-01-28 11:50                 ` [PATCH] net/tcp: Fix tcp memory limits initialization when !CONFIG_SYSCTL Ingo Molnar
2012-01-30 11:17                   ` Glauber Costa
  -- strict thread matches above, loose matches on Subject: below --
2012-01-30 11:20 Glauber Costa
2012-01-30 17:41 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.