From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-x22a.google.com (mail-qt0-x22a.google.com [IPv6:2607:f8b0:400d:c0d::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id C4A313B29E for ; Sun, 10 Dec 2017 21:52:29 -0500 (EST) Received: by mail-qt0-x22a.google.com with SMTP id a16so35044108qtj.3 for ; Sun, 10 Dec 2017 18:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=lBSrAW5Y+GfpVwR5J8PRcW24C8E3Uh84ol3U2Pf9Ru8=; b=teE5dSNsFuTmYvKiiRZOQt1cjjPuOsUQQQW8Cxo2v/fD/uIB2OIZud1gIfZ5Cslt/E dqXyujrMhdfhKSn0BBB66LnwGkM8tTeTg2e2Gb5OUoECKwUvtmKSy+dUyX0n2O9IvBx1 6rGov5h5ZGVe5wPb3qrOCf2SryBv5m4WGl52vYzs3OhoISed6YHLjEnAc0mdP1sCvOiJ n8DvONN8N8iLi3oUfywFDqhLSBpl0zHyqL+8jx+K5KsD+Y4Cnn4WWbvMzSSViFKovkWo 7q4aeOkNyh2gUobsQUQNoPDf3MY+v4OLIL41JK2eIrFkUBFHixjwbWu60FJFP0NfmmsS Hajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=lBSrAW5Y+GfpVwR5J8PRcW24C8E3Uh84ol3U2Pf9Ru8=; b=T+9ZM1xeZuYSr2Ud+5P60Hne7t8PM5rTunernLjACbdZh9M5xC3Q+l5idr9BmcHVtZ 7l1GaS4UfEr4AjtFOrlhJcbt/trEYKF3aq7PoXAbgNchafyHZT6fagTUmSg2kXWTsJH8 /1CJnSh97ziRPbymsPWHpm2VOAnFvVuiFmN/hRSiT/5AR+N5MQ659E9xL/G8XRw+10tq HAUnAMRHgUqvIDFgjlz82gMQ3uz1qMspJ4BY+Ftso30Iq3oD2MzlmR0n2paJ9TYtzQ0D GiLNco04203kfS0A8hklPIXtr85wjDdYAT5FG+NWIAiNvOi5nNGCB1I+IKyIQnVYzdZQ sp/w== X-Gm-Message-State: AKGB3mKHkd+jjKRrElnVcDA9xBvJnA2vqAE9NaE5uoe3fns3fRPDdWCa w/WGD4VvAOd3V6/lEWGs4gY/SHPc79+pHu6hOqY= X-Google-Smtp-Source: AGs4zMbNlJcDViCZuefUaAPL6RxqHGA1tkJ2QrY/7LgbkFrqomeTyYcHjrN8pvH5XR/4qn7k6DPYrS7O4xs/fxSsaTU= X-Received: by 10.200.46.50 with SMTP id r47mr24980074qta.314.1512960749140; Sun, 10 Dec 2017 18:52:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.193.93 with HTTP; Sun, 10 Dec 2017 18:52:28 -0800 (PST) From: Dave Taht Date: Sun, 10 Dec 2017 18:52:28 -0800 Message-ID: To: bloat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [Bloat] tcp: smoother receiver autotuning X-BeenThere: bloat@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: General list for discussing Bufferbloat List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 02:52:29 -0000 One of the hacks in the android world has been to limit the receive window. The patches eric just submitted might have some impact on the results reported here, years ago: https://pdfs.semanticscholar.org/b293/ec57821a27bfb96d15cd11d8141e04610153.= pdf ---------- Forwarded message ---------- From: Eric Dumazet Date: Sun, Dec 10, 2017 at 5:55 PM Subject: [PATCH net-next 3/3] tcp: smoother receiver autotuning To: "David S . Miller" , Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh , Wei Wang , Priyaranjan Jha Cc: netdev , Eric Dumazet , Eric Dumazet Back in linux-3.13 (commit b0983d3c9b13 ("tcp: fix dynamic right sizing")) I addressed the pressing issues we had with receiver autotuning. But DRS suffers from extra latencies caused by rcv_rtt_est.rtt_us drifts. One common problem happens during slow start, since the apparent RTT measured by the receiver can be inflated by ~50%, at the end of one packet train. Also, a single drop can delay read() calls by one RTT, meaning tcp_rcv_space_adjust() can be called one RTT too late. By replacing the tri-modal heuristic with a continuous function, we can offset the effects of not growing 'at the optimal time'. The curve of the function matches prior behavior if the space increased by 25% and 50% exactly. Cost of added multiply/divide is small, considering a TCP flow typically would run this part of the code few times in its life. I tested this patch with 100 ms RTT / 1% loss link, 100 runs of (netperf -l 5), and got an average throughput of 4600 Mbit instead of 1700 Mbit. Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Acked-by: Wei Wang --- net/ipv4/tcp_input.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2900e58738cde0ad1ab4a034b6300876ac276edb..fefb46c16de7b1da76443f714a3= f42faacca708d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -601,26 +601,17 @@ void tcp_rcv_space_adjust(struct sock *sk) if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { int rcvmem, rcvbuf; - u64 rcvwin; + u64 rcvwin, grow; /* minimal window to cope with packet losses, assuming * steady state. Add some cushion because of small variatio= ns. */ rcvwin =3D ((u64)copied << 1) + 16 * tp->advmss; - /* If rate increased by 25%, - * assume slow start, rcvwin =3D 3 * copied - * If rate increased by 50%, - * assume sender can use 2x growth, rcvwin =3D 4 * cop= ied - */ - if (copied >=3D - tp->rcvq_space.space + (tp->rcvq_space.space >> 2)) { - if (copied >=3D - tp->rcvq_space.space + (tp->rcvq_space.space >>= 1)) - rcvwin <<=3D 1; - else - rcvwin +=3D (rcvwin >> 1); - } + /* Accommodate for sender rate increase (eg. slow start) */ + grow =3D rcvwin * (copied - tp->rcvq_space.space); + do_div(grow, tp->rcvq_space.space); + rcvwin +=3D (grow << 1); rcvmem =3D SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER); while (tcp_win_from_space(sk, rcvmem) < tp->advmss) -- 2.15.1.424.g9478a66081-goog --=20 Dave T=C3=A4ht CEO, TekLibre, LLC http://www.teklibre.com Tel: 1-669-226-2619