diff options
author | Eric Dumazet <edumazet@google.com> | 2015-05-15 12:39:30 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-17 22:45:49 -0400 |
commit | b66e91ccbc34ebd5a2f90f9e1bc1597e2924a500 (patch) | |
tree | 13db6cdf2a7ff4f841f3ec44b5700a8e9af1b361 /net/ipv4/tcp.c | |
parent | 76dfa6082032b5c179864816fa508879421678eb (diff) |
tcp: halves tcp_mem[] limits
Allowing tcp to use ~19% of physical memory is way too much,
and allowed bugs to be hidden. Add to this that some drivers use a full
page per incoming frame, so real cost can be twice the advertized one.
Reduce tcp_mem by 50 % as a first step to sanity.
tcp_mem[0,1,2] defaults are now 4.68%, 6.25%, 9.37% of physical memory.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 9eabfd3e0925..c724195e5862 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3068,11 +3068,12 @@ __setup("thash_entries=", set_thash_entries); static void __init tcp_init_mem(void) { - unsigned long limit = nr_free_buffer_pages() / 8; + unsigned long limit = nr_free_buffer_pages() / 16; + limit = max(limit, 128UL); - sysctl_tcp_mem[0] = limit / 4 * 3; - sysctl_tcp_mem[1] = limit; - sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2; + sysctl_tcp_mem[0] = limit / 4 * 3; /* 4.68 % */ + sysctl_tcp_mem[1] = limit; /* 6.25 % */ + sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2; /* 9.37 % */ } void __init tcp_init(void) |