From patchwork Sat Nov 26 20:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 699548 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tR3wS2dcPz9vDV for ; Sun, 27 Nov 2016 07:10:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="P87Adi9w"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbcKZUKp (ORCPT ); Sat, 26 Nov 2016 15:10:45 -0500 Received: from mail-io0-f172.google.com ([209.85.223.172]:34013 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbcKZUKi (ORCPT ); Sat, 26 Nov 2016 15:10:38 -0500 Received: by mail-io0-f172.google.com with SMTP id c21so166766549ioj.1 for ; Sat, 26 Nov 2016 12:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LDD4zQE485o/ydK2SCOG3LWEKizKEMRuN5WBwo4Qp90=; b=P87Adi9whIRjTrucMNx4g2ik7ZVPCc6+gLzkpBrrOtvQDY6EELeEgN1MbIq0CqPNJ2 Fv6Qsaat6uSwDbzh7CZ5pLimahDCXKF6421qhCvjUdL0P731o18UWiQt+WrK0cHarzOd hxawTR0+mo6zmYgLjm/aDcrM2kXQyRbYt3UNadmsSIWljIK/BaxvaDRjVJLSy8MADjdJ Xpn0JTNp+K8EYPZUTSlVdZcrSPMojToAOyEpRLLpHkc4PUYQY5BjJsFWE+tRDWhXWOHx AdcQ+4x2jUENG+2QjoBlsxUXImj9dZIFUFAkGTpDTi2l3xXMYGnYRCB/HdLKlm1xGLC8 03KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LDD4zQE485o/ydK2SCOG3LWEKizKEMRuN5WBwo4Qp90=; b=LcgE5MLIGiljE+w8lEwGnv1ZkNt084Sw3Y809IuJFOHhH6Wzud/egBKG5KVotz3p1p rBegJrsSmZ8ajF5frkedgD4XpIFI6gaqdcfz+4Se+5xhYeYkOypdpRJmnHN0K3Dof8MO W5/fQ4xxUmo7rNoEhar4N56xbHl25jt3DNwn04sqlyDSA33uX9xMSYeJa/DI2tos0KAK Oz1RxI7TYUdcd/wgnjZxqeBrHN8w+Z1ggSPQ5z1ujvP2BHsNJiH3+EMa8WL2MbPYPjsk 1NiioW+PlHEiCvtHOHddlX7JGbUxPRB5DN+uSGAP9Dn7VNazrbl8B3BK2nCthNaSoPWz UGPw== X-Gm-Message-State: AKaTC01z+vkq4YZjrcntd4V1PkApsnW9TMaOagj7pezKT2SbeMOG01gyQ8LXH2GUaF3qWWg3 X-Received: by 10.36.148.84 with SMTP id j81mr12146486ite.35.1480191037734; Sat, 26 Nov 2016 12:10:37 -0800 (PST) Received: from ycheng2.mtv.corp.google.com ([172.17.93.15]) by smtp.gmail.com with ESMTPSA id c101sm17125063ioj.25.2016.11.26.12.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Nov 2016 12:10:37 -0800 (PST) From: Yuchung Cheng To: davem@davemloft.net, soheil@google.com, francisyyan@gmail.com Cc: netdev@vger.kernel.org, ncardwell@google.com, edumazet@google.com, Yuchung Cheng Subject: [PATCH net-next 3/6] tcp: instrument how long TCP is limited by receive window Date: Sat, 26 Nov 2016 12:10:13 -0800 Message-Id: <1480191016-73210-4-git-send-email-ycheng@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1480191016-73210-1-git-send-email-ycheng@google.com> References: <1480191016-73210-1-git-send-email-ycheng@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Francis Yan This patch measures the total time when the TCP stops sending because the receiver's advertised window is not large enough. Note that once the limit is lifted we are likely in the busy status if we have data pending. Signed-off-by: Francis Yan Signed-off-by: Yuchung Cheng Signed-off-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_output.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e8ea584..b74444c 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2144,7 +2144,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, unsigned int tso_segs, sent_pkts; int cwnd_quota; int result; - bool is_cwnd_limited = false; + bool is_cwnd_limited = false, is_rwnd_limited = false; u32 max_segs; sent_pkts = 0; @@ -2181,8 +2181,10 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, break; } - if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) + if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) { + is_rwnd_limited = true; break; + } if (tso_segs == 1) { if (unlikely(!tcp_nagle_test(tp, skb, mss_now, @@ -2227,6 +2229,11 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, break; } + if (is_rwnd_limited) + tcp_chrono_start(sk, TCP_CHRONO_RWND_LIMITED); + else + tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED); + if (likely(sent_pkts)) { if (tcp_in_cwnd_reduction(sk)) tp->prr_out += sent_pkts;