tcp/dccp: get rid of central timewait timer
Using a timer wheel for timewait sockets was nice ~15 years ago when memory was expensive and machines had a single processor. This does not scale, code is ugly and source of huge latencies (Typically 30 ms have been seen, cpus spinning on death_lock spinlock.) We can afford to use an extra 64 bytes per timewait sock and spread timewait load to all cpus to have better behavior. Tested: On following test, /proc/sys/net/ipv4/tcp_tw_recycle is set to 1 on the target (lpaa24) Before patch : lpaa23:~# ./super_netperf 200 -H lpaa24 -t TCP_CC -l 60 -- -p0,0 419594 lpaa23:~# ./super_netperf 200 -H lpaa24 -t TCP_CC -l 60 -- -p0,0 437171 While test is running, we can observe 25 or even 33 ms latencies. lpaa24:~# ping -c 1000 -i 0.02 -qn lpaa23 ... 1000 packets transmitted, 1000 received, 0% packet loss, time 20601ms rtt min/avg/max/mdev = 0.020/0.217/25.771/1.535 ms, pipe 2 lpaa24:~# ping -c 1000 -i 0.02 -qn lpaa23 ... 1000 packets transmitted, 1000 received, 0% packet loss, time 20702ms rtt min/avg/max/mdev = 0.019/0.183/33.761/1.441 ms, pipe 2 After patch : About 90% increase of throughput : lpaa23:~# ./super_netperf 200 -H lpaa24 -t TCP_CC -l 60 -- -p0,0 810442 lpaa23:~# ./super_netperf 200 -H lpaa24 -t TCP_CC -l 60 -- -p0,0 800992 And latencies are kept to minimal values during this load, even if network utilization is 90% higher : lpaa24:~# ping -c 1000 -i 0.02 -qn lpaa23 ... 1000 packets transmitted, 1000 received, 0% packet loss, time 19991ms rtt min/avg/max/mdev = 0.023/0.064/0.360/0.042 ms Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
20a1d16526
commit
789f558cfb
@@ -1486,7 +1486,7 @@ do_time_wait:
|
||||
ntohs(th->dest), tcp_v6_iif(skb));
|
||||
if (sk2) {
|
||||
struct inet_timewait_sock *tw = inet_twsk(sk);
|
||||
inet_twsk_deschedule(tw, &tcp_death_row);
|
||||
inet_twsk_deschedule(tw);
|
||||
inet_twsk_put(tw);
|
||||
sk = sk2;
|
||||
tcp_v6_restore_cb(skb);
|
||||
@@ -1728,9 +1728,9 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
|
||||
static void get_timewait6_sock(struct seq_file *seq,
|
||||
struct inet_timewait_sock *tw, int i)
|
||||
{
|
||||
long delta = tw->tw_timer.expires - jiffies;
|
||||
const struct in6_addr *dest, *src;
|
||||
__u16 destp, srcp;
|
||||
s32 delta = tw->tw_ttd - inet_tw_time_stamp();
|
||||
|
||||
dest = &tw->tw_v6_daddr;
|
||||
src = &tw->tw_v6_rcv_saddr;
|
||||
|
Reference in New Issue
Block a user