diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-08 20:16:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-13 06:44:02 -0400 |
commit | f373b53b5fe67aa4a6f28f921a529cc90f88e79b (patch) | |
tree | b2cae9152aed2e30b7a39c114678b9355ab5c14f /net/ipv4/tcp.c | |
parent | c3faca053d0a9c877597935b434150b422dbc6fb (diff) |
tcp: replace ehash_size by ehash_mask
Storing the mask (size - 1) instead of the size allows fast path to be
a bit faster.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 64d0af675823..cf13726259cd 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2865,11 +2865,10 @@ void __init tcp_init(void) | |||
2865 | (totalram_pages >= 128 * 1024) ? | 2865 | (totalram_pages >= 128 * 1024) ? |
2866 | 13 : 15, | 2866 | 13 : 15, |
2867 | 0, | 2867 | 0, |
2868 | &tcp_hashinfo.ehash_size, | ||
2869 | NULL, | 2868 | NULL, |
2869 | &tcp_hashinfo.ehash_mask, | ||
2870 | thash_entries ? 0 : 512 * 1024); | 2870 | thash_entries ? 0 : 512 * 1024); |
2871 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; | 2871 | for (i = 0; i <= tcp_hashinfo.ehash_mask; i++) { |
2872 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { | ||
2873 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i); | 2872 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i); |
2874 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].twchain, i); | 2873 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].twchain, i); |
2875 | } | 2874 | } |
@@ -2878,7 +2877,7 @@ void __init tcp_init(void) | |||
2878 | tcp_hashinfo.bhash = | 2877 | tcp_hashinfo.bhash = |
2879 | alloc_large_system_hash("TCP bind", | 2878 | alloc_large_system_hash("TCP bind", |
2880 | sizeof(struct inet_bind_hashbucket), | 2879 | sizeof(struct inet_bind_hashbucket), |
2881 | tcp_hashinfo.ehash_size, | 2880 | tcp_hashinfo.ehash_mask + 1, |
2882 | (totalram_pages >= 128 * 1024) ? | 2881 | (totalram_pages >= 128 * 1024) ? |
2883 | 13 : 15, | 2882 | 13 : 15, |
2884 | 0, | 2883 | 0, |
@@ -2933,8 +2932,8 @@ void __init tcp_init(void) | |||
2933 | sysctl_tcp_rmem[2] = max(87380, max_share); | 2932 | sysctl_tcp_rmem[2] = max(87380, max_share); |
2934 | 2933 | ||
2935 | printk(KERN_INFO "TCP: Hash tables configured " | 2934 | printk(KERN_INFO "TCP: Hash tables configured " |
2936 | "(established %d bind %d)\n", | 2935 | "(established %u bind %u)\n", |
2937 | tcp_hashinfo.ehash_size, tcp_hashinfo.bhash_size); | 2936 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
2938 | 2937 | ||
2939 | tcp_register_congestion_control(&tcp_reno); | 2938 | tcp_register_congestion_control(&tcp_reno); |
2940 | } | 2939 | } |