Commit fd90b29d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: change default tcp hash size

As time passed, available memory increased faster than number of
concurrent tcp sockets.

As a result, a machine with 4GB of ram gets a hash table
with 524288 slots, using 8388608 bytes of memory.

Lets change that by a 16x factor (one slot for 128 KB of ram)

Even if a small machine needs a _lot_ of sockets, tcp lookups are now
very efficient, using one cache line per socket.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abe303db
...@@ -3590,8 +3590,7 @@ void __init tcp_init(void) ...@@ -3590,8 +3590,7 @@ void __init tcp_init(void)
alloc_large_system_hash("TCP established", alloc_large_system_hash("TCP established",
sizeof(struct inet_ehash_bucket), sizeof(struct inet_ehash_bucket),
thash_entries, thash_entries,
(totalram_pages >= 128 * 1024) ? 17, /* one slot per 128 KB of memory */
13 : 15,
0, 0,
NULL, NULL,
&tcp_hashinfo.ehash_mask, &tcp_hashinfo.ehash_mask,
...@@ -3607,8 +3606,7 @@ void __init tcp_init(void) ...@@ -3607,8 +3606,7 @@ void __init tcp_init(void)
alloc_large_system_hash("TCP bind", alloc_large_system_hash("TCP bind",
sizeof(struct inet_bind_hashbucket), sizeof(struct inet_bind_hashbucket),
tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.ehash_mask + 1,
(totalram_pages >= 128 * 1024) ? 17, /* one slot per 128 KB of memory */
13 : 15,
0, 0,
&tcp_hashinfo.bhash_size, &tcp_hashinfo.bhash_size,
NULL, NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment