netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyich@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, Sergei Trofimovich <slyfox@gentoo.org>,
	Jason Wang <jasowang@redhat.com>,
	Glauber Costa <glommer@parallels.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCHv 2] tcp: properly initialize tcp memory limits part 2 (fix nfs regression)
Date: Fri,  2 Mar 2012 10:59:33 +0300	[thread overview]
Message-ID: <1330675173-18968-1-git-send-email-slyich@gmail.com> (raw)

From: Sergei Trofimovich <slyfox@gentoo.org>

The commit c43b874d5d7 introduced NFS file transfer hangup (proved by bisection).
> Commit 4acb4190 tries to fix the using uninitialized value
> introduced by commit 3dc43e3,  but it would make the
> per-socket memory limits too small.
>
> This patch fixes this and also remove the redundant codes
> introduced in 4acb4190.

The change looks like a typo (division flipped to multiplication):
> limit = nr_free_buffer_pages() / 8;
> limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);

Patch restores division.

CC: Jason Wang <jasowang@redhat.com>
CC: Glauber Costa <glommer@parallels.com>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Tested-by: Sergei Trofimovich <slyfox@gentoo.org>
---

Change since v1: added forgotten commit ID

 net/ipv4/tcp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 22ef5f9..b11667b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3299,7 +3299,7 @@ void __init tcp_init(void)
 
 	tcp_init_mem(&init_net);
 	/* Set per-socket limits to no more than 1/128 the pressure threshold */
-	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);
+	limit = nr_free_buffer_pages() >> (PAGE_SHIFT - 10);
 	limit = max(limit, 128UL);
 	max_share = min(4UL*1024*1024, limit);
 
-- 
1.7.8.5

             reply	other threads:[~2012-03-02  7:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  7:59 Sergei Trofimovich [this message]
2012-03-02  9:22 ` [PATCHv 2] tcp: properly initialize tcp memory limits part 2 (fix nfs regression) Jason Wang
2012-03-02 17:24   ` Sergei Trofimovich
2012-03-02 17:50     ` Sergei Trofimovich
2012-03-03 14:16       ` Glauber Costa
2012-03-03 14:43         ` Sergei Trofimovich
2012-03-03 23:27           ` Glauber Costa
2012-03-04  9:14             ` Sergei Trofimovich
2012-03-05  6:18               ` Jason Wang
2012-03-05 18:22                 ` Sergei Trofimovich
2012-03-06  3:22                   ` Jason Wang

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=1330675173-18968-1-git-send-email-slyich@gmail.com \
    --to=slyich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=glommer@parallels.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=slyfox@gentoo.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).