From patchwork Thu Dec 7 17:43:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 845721 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="IlK/BB+x"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yt2sW2PfVz9ryT for ; Fri, 8 Dec 2017 04:43:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753063AbdLGRnr (ORCPT ); Thu, 7 Dec 2017 12:43:47 -0500 Received: from mail-yb0-f196.google.com ([209.85.213.196]:42691 "EHLO mail-yb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbdLGRnm (ORCPT ); Thu, 7 Dec 2017 12:43:42 -0500 Received: by mail-yb0-f196.google.com with SMTP id t127so3280709ybf.9 for ; Thu, 07 Dec 2017 09:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pEVHDBYx+rLUcKow/50dWCNpuuoPMHnA1jOr38Ngplk=; b=IlK/BB+xq4jHb1anZhyDM1m1ILCW4QzPxEL08dJpURohLpubDbpJLYBYpyYTFteyi+ sw0/4vWUexenX3xh0XJnB3eGuivXQuuTjaTxDHCLoejLwJpLLc5e5o3Fujl40R6yMoIS UQ4yoGDvot4lpsXKyOx8W82CdiT5pHLwa0y8kYdOGK3A8XznrnlUTJL0BYMjOZ8Q9OaO 9CLVV6XpkH707Nw9MFFkus51DrDGI1d41kdgKZxBGvvrnjt+QU+dITctr17sp6f25upb SykUSo1Rg6T1et6Bib9T9ruKMecXycb2j5wlNneZjbCql0L1CN7ce5PsK6brMHHYN8CR Frjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pEVHDBYx+rLUcKow/50dWCNpuuoPMHnA1jOr38Ngplk=; b=crQoqRHTOyFNCYu8jaTqpWkYD6zVh+XVCs64MYspX9Q+A+HimROLwh4PjI4jvZfuoM IUnetl5rZm0NwFZnFo3KxmaVYy6Ho77OzwEry8v6KxkSyrfuKPPZlbNodgs2dKgHzX7p mL7lNprXav9nMsS+7Rzdtd/STXmGHj1bDbrhLcW5CBoVXoL9JFSPcB/rVbLrEFrn+Juo iAUP29Z4WoYcHaXEMbb8Eh8IA2GsnVZJmIymCnRmHsOuRTZ7vL+6o/xQA3JBMD2ID8TE NZKmO+HnygSKPtPM025CdX0kUtG7ahjQ1reL8Mk1pqr/7z6u1N+W8UbdDKgDL9/193IL qfIQ== X-Gm-Message-State: AKGB3mKOPtDf8ZPWMTO26BzYxTn2lX4dpqrmMCAfWGN6JKIJXc0TgPRf WpaNI+Ku0DMYFejgP8e9uGXwFg== X-Google-Smtp-Source: AGs4zMZazCJn2XscW71BwWFVF0wm/nFG+ro5RfMmTOb+7OK0/esMe1PTtkoSMzBXb+XR6h7p65XkMQ== X-Received: by 10.37.37.79 with SMTP id l76mr1145457ybl.39.1512668621587; Thu, 07 Dec 2017 09:43:41 -0800 (PST) Received: from joy.nyc.corp.google.com ([100.101.212.71]) by smtp.gmail.com with ESMTPSA id m129sm2577019ywd.66.2017.12.07.09.43.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Dec 2017 09:43:40 -0800 (PST) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell Subject: [PATCH net 1/3] tcp_bbr: record "full bw reached" decision in new full_bw_reached bit Date: Thu, 7 Dec 2017 12:43:30 -0500 Message-Id: <20171207174332.17689-2-ncardwell@google.com> X-Mailer: git-send-email 2.15.1.424.g9478a66081-goog In-Reply-To: <20171207174332.17689-1-ncardwell@google.com> References: <20171207174332.17689-1-ncardwell@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit records the "full bw reached" decision in a new full_bw_reached bit. This is a pure refactor that does not change the current behavior, but enables subsequent fixes and improvements. In particular, this enables simple and clean fixes because the full_bw and full_bw_cnt can be unconditionally zeroed without worrying about forgetting that we estimated we filled the pipe in Startup. And it enables future improvements because multiple code paths can be used for estimating that we filled the pipe in Startup; any new code paths only need to set this bit when they think the pipe is full. Note that this fix intentionally reduces the width of the full_bw_cnt counter, since we have never used the most significant bit. Signed-off-by: Neal Cardwell Reviewed-by: Yuchung Cheng Acked-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_bbr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c index 69ee877574d0..3089c956b9f9 100644 --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -110,7 +110,8 @@ struct bbr { u32 lt_last_lost; /* LT intvl start: tp->lost */ u32 pacing_gain:10, /* current gain for setting pacing rate */ cwnd_gain:10, /* current gain for setting cwnd */ - full_bw_cnt:3, /* number of rounds without large bw gains */ + full_bw_reached:1, /* reached full bw in Startup? */ + full_bw_cnt:2, /* number of rounds without large bw gains */ cycle_idx:3, /* current index in pacing_gain cycle array */ has_seen_rtt:1, /* have we seen an RTT sample yet? */ unused_b:5; @@ -180,7 +181,7 @@ static bool bbr_full_bw_reached(const struct sock *sk) { const struct bbr *bbr = inet_csk_ca(sk); - return bbr->full_bw_cnt >= bbr_full_bw_cnt; + return bbr->full_bw_reached; } /* Return the windowed max recent bandwidth sample, in pkts/uS << BW_SCALE. */ @@ -717,6 +718,7 @@ static void bbr_check_full_bw_reached(struct sock *sk, return; } ++bbr->full_bw_cnt; + bbr->full_bw_reached = bbr->full_bw_cnt >= bbr_full_bw_cnt; } /* If pipe is probably full, drain the queue and then enter steady-state. */ @@ -850,6 +852,7 @@ static void bbr_init(struct sock *sk) bbr->restore_cwnd = 0; bbr->round_start = 0; bbr->idle_restart = 0; + bbr->full_bw_reached = 0; bbr->full_bw = 0; bbr->full_bw_cnt = 0; bbr->cycle_mstamp = 0;