diff options
author | Jean Delvare <jdelvare@suse.de> | 2007-10-30 03:59:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-30 03:59:25 -0400 |
commit | 0ccfe61803ad24f1c0fe5e1f5ce840ff0f3d9660 (patch) | |
tree | 5af62008d8e69df7866b7b3dd18db6a641e6b32f /net/ipv4/tcp.c | |
parent | e08a132b0ef3cf89dfbf1dea2c6248ea624bdcd7 (diff) |
[TCP]: Saner thash_entries default with much memory.
On systems with a very large amount of memory, the heuristics in
alloc_large_system_hash() result in a very large TCP established hash
table: 16 millions of entries for a 128 GB ia64 system. This makes
reading from /proc/net/tcp pretty slow (well over a second) and as a
result netstat is slow on these machines. I know that /proc/net/tcp is
deprecated in favor of tcp_diag, however at the moment netstat only
knows of the former.
I am skeptical that such a large TCP established hash is often needed.
Just because a system has a lot of memory doesn't imply that it will
have several millions of concurrent TCP connections. Thus I believe
that we should put an arbitrary high limit to the size of the TCP
established hash by default. Users who really need a bigger hash can
always use the thash_entries boot parameter to get more.
I propose 2 millions of entries as the arbitrary high limit. This
makes /proc/net/tcp reasonably fast on the system in question (0.2 s)
while being still large enough for me to be confident that network
performance won't suffer.
This is just one way to limit the hash size, there are others; I am not
familiar enough with the TCP code to decide which is best. Thus, I
would welcome the proposals of alternatives.
[ 2 million is still too large, thus I've modified the limit in the
change to be '512 * 1024'. -DaveM ]
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | 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 2e6ad6dbba6c..c64072bb504b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2453,7 +2453,7 @@ void __init tcp_init(void) | |||
2453 | 0, | 2453 | 0, |
2454 | &tcp_hashinfo.ehash_size, | 2454 | &tcp_hashinfo.ehash_size, |
2455 | NULL, | 2455 | NULL, |
2456 | 0); | 2456 | thash_entries ? 0 : 512 * 1024); |
2457 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; | 2457 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; |
2458 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { | 2458 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { |
2459 | rwlock_init(&tcp_hashinfo.ehash[i].lock); | 2459 | rwlock_init(&tcp_hashinfo.ehash[i].lock); |