• Dust Li's avatar
    net/smc: add autocorking support · dcd2cf5f
    Dust Li authored
    This patch adds autocorking support for SMC which could improve
    throughput for small message by x3+.
    
    The main idea is borrowed from TCP autocorking with some RDMA
    specific modification:
    1. The first message should never cork to make sure we won't
       bring extra latency
    2. If we have posted any Tx WRs to the NIC that have not
       completed, cork the new messages until:
       a) Receive CQE for the last Tx WR
       b) We have corked enough message on the connection
    3. Try to push the corked data out when we receive CQE of
       the last Tx WR to prevent the corked messages hang in
       the send queue.
    
    Both SMC autocorking and TCP autocorking check the TX completion
    to decide whether we should cork or not. The difference is
    when we got a SMC Tx WR completion, the data have been confirmed
    by the RNIC while TCP TX completion just tells us the data
    have been sent out by the local NIC.
    
    Add an atomic variable tx_pushing in smc_connection to make
    sure only one can send to let it cork more and save CDC slot.
    
    SMC autocorking should not bring extra latency since the first
    message will always been sent out immediately.
    
    The qperf tcp_bw test shows more than x4 increase under small
    message size with Mellanox connectX4-Lx, same result with other
    throughput benchmarks like sockperf/netperf.
    The qperf tcp_lat test shows SMC autocorking has not increase any
    ping-pong latency.
    
    Test command:
     client: smc_run taskset -c 1 qperf smc-server -oo msg_size:1:64K:*2 \
    			-t 30 -vu tcp_{bw|lat}
     server: smc_run taskset -c 1 qperf
    
    === Bandwidth ====
    MsgSize(Bytes)  SMC-NoCork           TCP                      SMC-AutoCorking
          1         0.578 MB/s       2.392 MB/s(313.57%)        2.647 MB/s(357.72%)
          2         1.159 MB/s       4.780 MB/s(312.53%)        5.153 MB/s(344.71%)
          4         2.283 MB/s      10.266 MB/s(349.77%)       10.363 MB/s(354.02%)
          8         4.668 MB/s      19.040 MB/s(307.86%)       21.215 MB/s(354.45%)
         16         9.147 MB/s      38.904 MB/s(325.31%)       41.740 MB/s(356.32%)
         32        18.369 MB/s      79.587 MB/s(333.25%)       82.392 MB/s(348.52%)
         64        36.562 MB/s     148.668 MB/s(306.61%)      161.564 MB/s(341.89%)
        128        72.961 MB/s     274.913 MB/s(276.80%)      325.363 MB/s(345.94%)
        256       144.705 MB/s     512.059 MB/s(253.86%)      633.743 MB/s(337.96%)
        512       288.873 MB/s     884.977 MB/s(206.35%)     1250.681 MB/s(332.95%)
       1024       574.180 MB/s    1337.736 MB/s(132.98%)     2246.121 MB/s(291.19%)
       2048      1095.192 MB/s    1865.952 MB/s( 70.38%)     2057.767 MB/s( 87.89%)
       4096      2066.157 MB/s    2380.337 MB/s( 15.21%)     2173.983 MB/s(  5.22%)
       8192      3717.198 MB/s    2733.073 MB/s(-26.47%)     3491.223 MB/s( -6.08%)
      16384      4742.221 MB/s    2958.693 MB/s(-37.61%)     4637.692 MB/s( -2.20%)
      32768      5349.550 MB/s    3061.285 MB/s(-42.77%)     5385.796 MB/s(  0.68%)
      65536      5162.919 MB/s    3731.408 MB/s(-27.73%)     5223.890 MB/s(  1.18%)
    ==== Latency ====
    MsgSize(Bytes)   SMC-NoCork         TCP                    SMC-AutoCorking
          1          10.540 us      11.938 us( 13.26%)       10.573 us(  0.31%)
          2          10.996 us      11.992 us(  9.06%)       10.269 us( -6.61%)
          4          10.229 us      11.687 us( 14.25%)       10.240 us(  0.11%)
          8          10.203 us      11.653 us( 14.21%)       10.402 us(  1.95%)
         16          10.530 us      11.313 us(  7.44%)       10.599 us(  0.66%)
         32          10.241 us      11.586 us( 13.13%)       10.223 us( -0.18%)
         64          10.693 us      11.652 us(  8.97%)       10.251 us( -4.13%)
        128          10.597 us      11.579 us(  9.27%)       10.494 us( -0.97%)
        256          10.409 us      11.957 us( 14.87%)       10.710 us(  2.89%)
        512          11.088 us      12.505 us( 12.78%)       10.547 us( -4.88%)
       1024          11.240 us      12.255 us(  9.03%)       10.787 us( -4.03%)
       2048          11.485 us      16.970 us( 47.76%)       11.256 us( -1.99%)
       4096          12.077 us      13.948 us( 15.49%)       12.230 us(  1.27%)
       8192          13.683 us      16.693 us( 22.00%)       13.786 us(  0.75%)
      16384          16.470 us      23.615 us( 43.38%)       16.459 us( -0.07%)
      32768          22.540 us      40.966 us( 81.75%)       23.284 us(  3.30%)
      65536          34.192 us      73.003 us(113.51%)       34.233 us(  0.12%)
    
    With SMC autocorking support, we can archive better throughput
    than TCP in most message sizes without any latency trade-off.
    Signed-off-by: default avatarDust Li <dust.li@linux.alibaba.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    dcd2cf5f
smc_cdc.c 13.9 KB