linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [v3.3-rc1 regression] TCP: too many of orphaned sockets
Date: Fri, 27 Jan 2012 18:35:32 +0400	[thread overview]
Message-ID: <4F22B634.2020007@parallels.com> (raw)
In-Reply-To: <20120127142246.GA22318@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

On 01/27/2012 06:22 PM, Ingo Molnar wrote:
>
> * Ingo Molnar<mingo@elte.hu>  wrote:
>
>> ok, i've bisected it, and the bad commit is:
>>
>> 3dc43e3e4d0b52197d3205214fe8f162f9e0c334 is the first bad commit
>> commit 3dc43e3e4d0b52197d3205214fe8f162f9e0c334
>> Author: Glauber Costa<glommer@parallels.com>
>> Date:   Sun Dec 11 21:47:05 2011 +0000
>>
>>      per-netns ipv4 sysctl_tcp_mem
>
> Might be related to this detail in the .config:
>
>   # CONFIG_PROC_SYSCTL is not set
>
> So former tcp_init() code does not get run?
>
> Thanks,
>
> 	Ingo

Can you tell me if the following patch fixes your problem?


[-- Attachment #2: test.patch --]
[-- Type: text/x-patch, Size: 1002 bytes --]

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 9bcdec3..366834b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3276,9 +3276,23 @@ void __init tcp_init(void)
 	sysctl_tcp_max_orphans = cnt / 2;
 	sysctl_max_syn_backlog = max(128, cnt / 256);
 
+	/*
+	 * Despite the sysctl name, those values are always used in the code.
+	 * CONFIG_PROC_SYSCTL only exposes it as a sysctl, allowing the admin
+	 * to tweak them. If this is not configured, we need to provide
+	 * a default value here
+	 */
+#ifdef CONFIG_PROC_SYSCTL
 	/* 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);
+#else
+	limit = nr_free_buffer_pages() / 8;
+	limit = max(limit, 128UL);
+	init_net.ipv4.sysctl_tcp_mem[0] = limit / 4 * 3;
+	init_net.ipv4.sysctl_tcp_mem[1] = limit;
+	init_net.ipv4.sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
+#endif
 	max_share = min(4UL*1024*1024, limit);
 
 	sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;

  parent reply	other threads:[~2012-01-27 14:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
     [not found] <inTpE-FS-29@gated-at.bofh.it>
2012-01-30 22:13 ` [v3.3-rc1 regression] TCP: too many of orphaned sockets Arun Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F22B634.2020007@parallels.com \
    --to=glommer@parallels.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).