Commit fd90b29d757827ab12d6669292612308ec249532

Authored by Eric Dumazet
Committed by David S. Miller
1 parent abe303dbc2

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: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

... ... @@ -3590,8 +3590,7 @@
3590 3590 alloc_large_system_hash("TCP established",
3591 3591 sizeof(struct inet_ehash_bucket),
3592 3592 thash_entries,
3593   - (totalram_pages >= 128 * 1024) ?
3594   - 13 : 15,
  3593 + 17, /* one slot per 128 KB of memory */
3595 3594 0,
3596 3595 NULL,
3597 3596 &tcp_hashinfo.ehash_mask,
... ... @@ -3607,8 +3606,7 @@
3607 3606 alloc_large_system_hash("TCP bind",
3608 3607 sizeof(struct inet_bind_hashbucket),
3609 3608 tcp_hashinfo.ehash_mask + 1,
3610   - (totalram_pages >= 128 * 1024) ?
3611   - 13 : 15,
  3609 + 17, /* one slot per 128 KB of memory */
3612 3610 0,
3613 3611 &tcp_hashinfo.bhash_size,
3614 3612 NULL,