• Eric Dumazet's avatar
    tcp: restore autocorking · 114f39fe
    Eric Dumazet authored
    When adding rb-tree for TCP retransmit queue, we inadvertently broke
    TCP autocorking.
    
    tcp_should_autocork() should really check if the rtx queue is not empty.
    
    Tested:
    
    Before the fix :
    $ nstat -n;./netperf -H 10.246.7.152 -Cc -- -m 500;nstat | grep AutoCork
    MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.246.7.152 () port 0 AF_INET
    Recv   Send    Send                          Utilization       Service Demand
    Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
    Size   Size    Size     Time     Throughput  local    remote   local   remote
    bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
    
    540000 262144    500    10.00      2682.85   2.47     1.59     3.618   2.329
    TcpExtTCPAutoCorking            33                 0.0
    
    // Same test, but forcing TCP_NODELAY
    $ nstat -n;./netperf -H 10.246.7.152 -Cc -- -D -m 500;nstat | grep AutoCork
    MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.246.7.152 () port 0 AF_INET : nodelay
    Recv   Send    Send                          Utilization       Service Demand
    Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
    Size   Size    Size     Time     Throughput  local    remote   local   remote
    bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
    
    540000 262144    500    10.00      1408.75   2.44     2.96     6.802   8.259
    TcpExtTCPAutoCorking            1                  0.0
    
    After the fix :
    $ nstat -n;./netperf -H 10.246.7.152 -Cc -- -m 500;nstat | grep AutoCork
    MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.246.7.152 () port 0 AF_INET
    Recv   Send    Send                          Utilization       Service Demand
    Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
    Size   Size    Size     Time     Throughput  local    remote   local   remote
    bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
    
    540000 262144    500    10.00      5472.46   2.45     1.43     1.761   1.027
    TcpExtTCPAutoCorking            361293             0.0
    
    // With TCP_NODELAY option
    $ nstat -n;./netperf -H 10.246.7.152 -Cc -- -D -m 500;nstat | grep AutoCork
    MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.246.7.152 () port 0 AF_INET : nodelay
    Recv   Send    Send                          Utilization       Service Demand
    Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
    Size   Size    Size     Time     Throughput  local    remote   local   remote
    bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
    
    540000 262144    500    10.00      5454.96   2.46     1.63     1.775   1.174
    TcpExtTCPAutoCorking            315448             0.0
    
    Fixes: 75c119af ("tcp: implement rb-tree based retransmit queue")
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Reported-by: default avatarMichael Wenig <mwenig@vmware.com>
    Tested-by: default avatarMichael Wenig <mwenig@vmware.com>
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Reported-by: default avatarMichael Wenig <mwenig@vmware.com>
    Tested-by: default avatarMichael Wenig <mwenig@vmware.com>
    Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
    Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    114f39fe
tcp.c 94.9 KB