Skip to content

Commit

Permalink
tcp: restore correct limit
Browse files Browse the repository at this point in the history
Commit c43b874 (tcp: properly initialize tcp memory limits) tried
to fix a regression added in commits 4acb419 & 3dc43e3,
but still get it wrong.

Result is machines with low amount of memory have too small tcp_rmem[2]
value and slow tcp receives : Per socket limit being 1/1024 of memory
instead of 1/128 in old kernels, so rcv window is capped to small
values.

Fix this to match comment and previous behavior.

Signed-off-by: Eric Dumazet <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Glauber Costa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Apr 10, 2012
1 parent ecd159f commit 5fb84b1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3302,8 +3302,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 = max(limit, 128UL);
limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
max_share = min(4UL*1024*1024, limit);

sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
Expand Down

0 comments on commit 5fb84b1

Please sign in to comment.