tcp: md5: remove spinlock usage in fast path
authorEric Dumazet <edumazet@google.com>
Mon, 20 May 2013 06:52:26 +0000 (06:52 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 1 Jan 2015 01:27:52 +0000 (01:27 +0000)
commit10f2216850e5955d102f8a052f5f3621e1aca328
treef5090a93797118448f919eebc1cc5e30d9bb3891
parent0aba46add2915b344580569e87d9c41274b9c475
tcp: md5: remove spinlock usage in fast path

commit 71cea17ed39fdf1c0634f530ddc6a2c2fc601c2b upstream.

TCP md5 code uses per cpu variables but protects access to them with
a shared spinlock, which is a contention point.

[ tcp_md5sig_pool_lock is locked twice per incoming packet ]

Makes things much simpler, by allocating crypto structures once, first
time a socket needs md5 keys, and not deallocating them as they are
really small.

Next step would be to allow crypto allocations being done in a NUMA
aware way.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2:
 - Adjust context
 - Conditions for alloc/free are quite different]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
include/net/tcp.h
net/ipv4/tcp.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv6/tcp_ipv6.c