summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-11-27 15:03:21 -0800
committerDavid S. Miller <davem@davemloft.net>2018-11-30 13:28:03 -0800
commit6015c71e656bb6895b416c31a8b7db457e45cecf (patch)
treeba31e8ae21f52048e475daa33f6bb86df5bfc3b5 /net/ipv4/tcp.c
parent2f69555315ad7dc1ac37366b2ac2429e2d24d444 (diff)
downloadlinux-6015c71e656bb6895b416c31a8b7db457e45cecf.tar.gz
linux-6015c71e656bb6895b416c31a8b7db457e45cecf.tar.bz2
linux-6015c71e656bb6895b416c31a8b7db457e45cecf.zip
tcp: md5: add tcp_md5_needed jump label
Most linux hosts never setup TCP MD5 keys. We can avoid a cache line miss (accessing tp->md5ig_info) on RX and TX using a jump label. 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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 252048776dbb..215e4d3b3616 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3656,8 +3656,11 @@ bool tcp_alloc_md5sig_pool(void)
if (unlikely(!tcp_md5sig_pool_populated)) {
mutex_lock(&tcp_md5sig_mutex);
- if (!tcp_md5sig_pool_populated)
+ if (!tcp_md5sig_pool_populated) {
__tcp_alloc_md5sig_pool();
+ if (tcp_md5sig_pool_populated)
+ static_key_slow_inc(&tcp_md5_needed);
+ }
mutex_unlock(&tcp_md5sig_mutex);
}