inet: get rid of central tcp/dccp listener timer
authorEric Dumazet <edumazet@google.com>
Fri, 20 Mar 2015 02:04:20 +0000 (19:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Mar 2015 16:40:25 +0000 (12:40 -0400)
commitfa76ce7328b289b6edd476e24eb52fd634261720
tree2e4c116a4e299700c185d73018bbb3518e46e1bb
parent52452c542559ac980b48dbf22a30ee7fa0af507c
inet: get rid of central tcp/dccp listener timer

One of the major issue for TCP is the SYNACK rtx handling,
done by inet_csk_reqsk_queue_prune(), fired by the keepalive
timer of a TCP_LISTEN socket.

This function runs for awful long times, with socket lock held,
meaning that other cpus needing this lock have to spin for hundred of ms.

SYNACK are sent in huge bursts, likely to cause severe drops anyway.

This model was OK 15 years ago when memory was very tight.

We now can afford to have a timer per request sock.

Timer invocations no longer need to lock the listener,
and can be run from all cpus in parallel.

With following patch increasing somaxconn width to 32 bits,
I tested a listener with more than 4 million active request sockets,
and a steady SYNFLOOD of ~200,000 SYN per second.
Host was sending ~830,000 SYNACK per second.

This is ~100 times more what we could achieve before this patch.

Later, we will get rid of the listener hash and use ehash instead.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
18 files changed:
include/net/inet6_connection_sock.h
include/net/inet_connection_sock.h
include/net/request_sock.h
net/core/request_sock.c
net/core/sock.c
net/dccp/ipv4.c
net/dccp/ipv6.c
net/dccp/timer.c
net/ipv4/inet_connection_sock.c
net/ipv4/inet_diag.c
net/ipv4/syncookies.c
net/ipv4/tcp_fastopen.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_timer.c
net/ipv6/inet6_connection_sock.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c