From patchwork Wed Jan 31 20:43:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 868069 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="VGMurnIP"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zWwFB4jXWz9sP9 for ; Thu, 1 Feb 2018 07:43:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbeAaUnX (ORCPT ); Wed, 31 Jan 2018 15:43:23 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:39153 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbeAaUnW (ORCPT ); Wed, 31 Jan 2018 15:43:22 -0500 Received: by mail-qt0-f194.google.com with SMTP id f4so23601735qtj.6 for ; Wed, 31 Jan 2018 12:43:22 -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; bh=ZbDe/vtc0tjm6f+jbUuKxqCTb1gE6YNl5P/niP5JuXQ=; b=VGMurnIPFui4flM1mmSWKr/J3rnekxEM40E0j405wcP97BV4SX5YeVbeBfqCbdsURd 1PqivXwhlzqIgK4bRYPogBl6w/qbYFhZuohmU+ADGdeNq9mvJ63SIg2hL7shZp6sxtzd vUemsP9mXvpAea8i0m50IjPNwdmVfoqGybnJjCRcl1d7P/bcQDXW84q0IETWEHghbYLM XNRyKuOoBqzl6hesRKEDhZb9XbL08cRy9dbG7rVUlZP7KN3zH/6HgwRJjIS2vYbKSJNW 3/qtieT889c7nOsQMAlHiXx1jZCG2/ElRjuCnSRH4kSx5J+Ia3XCIIN0+9r7bv/GhdEt 9Lyg== 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; bh=ZbDe/vtc0tjm6f+jbUuKxqCTb1gE6YNl5P/niP5JuXQ=; b=of+BGuHTpaHyDc5tOzpUqzc6ZMOAIGw+dSkLrJE0pp/3KaLhjOvPPXj1sLgbL7W5Gc YvsICQIcUacwu/++B3Iu7jGA3HLB4LAwB+5I4/S1hQEO2AxfjlIOptjwiRmwn6GGgPf9 JtyUlIJG5+d2e1FApEM2t5oGz49ZFpdQFsL4tyOJ9Tc2MJGRlBaTmOsAR+V84pj4dYHo keHbiwmJ0DX+Z7iuVJbQnP13+i0Pd2h9ZDkRNP3u4cOdSeceB6qKbVd8O6OFKht+Jd+y g5otCCSJO4ZDjU7wZqK4zjV2+2e4NtrUfIDYtPfYYgj+OH6wn42X+3hM89i9Bdr1DAUX IJ0A== X-Gm-Message-State: AKwxytdH73gOLL8dzbFa4/mlviFEC6Wpu7ElaNuBj79+98dei9qLScQo m2YFdhEQmwQ/3jJgpM8kE+DBaNohgIo= X-Google-Smtp-Source: AH8x225k1o0A31YVi2W7MLWqnIBkZCfPFC8yTvEaJV7POTapP3tZrbINkai+7EkHCLWQd9/J189pUg== X-Received: by 10.237.48.106 with SMTP id 97mr14456732qte.48.1517431401216; Wed, 31 Jan 2018 12:43:21 -0800 (PST) Received: from joy.nyc.corp.google.com ([100.101.213.17]) by smtp.gmail.com with ESMTPSA id i2sm11313611qkf.49.2018.01.31.12.43.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jan 2018 12:43:19 -0800 (PST) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh Subject: [PATCH net] tcp_bbr: fix pacing_gain to always be unity when using lt_bw Date: Wed, 31 Jan 2018 15:43:05 -0500 Message-Id: <20180131204305.236274-1-ncardwell@google.com> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit fixes the pacing_gain to remain at BBR_UNIT (1.0) when using lt_bw and returning from the PROBE_RTT state to PROBE_BW. Previously, when using lt_bw, upon exiting PROBE_RTT and entering PROBE_BW the bbr_reset_probe_bw_mode() code could sometimes randomly end up with a cycle_idx of 0 and hence have bbr_advance_cycle_phase() set a pacing gain above 1.0. In such cases this would result in a pacing rate that is 1.25x higher than intended, potentially resulting in a high loss rate for a little while until we stop using the lt_bw a bit later. This commit is a stable candidate for kernels back as far as 4.9. Fixes: 0f8782ea1497 ("tcp_bbr: add BBR congestion control") Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Soheil Hassas Yeganeh Reported-by: Beyers Cronje --- net/ipv4/tcp_bbr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c index 8322f26e770e..25c5a0b60cfc 100644 --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -481,7 +481,8 @@ static void bbr_advance_cycle_phase(struct sock *sk) bbr->cycle_idx = (bbr->cycle_idx + 1) & (CYCLE_LEN - 1); bbr->cycle_mstamp = tp->delivered_mstamp; - bbr->pacing_gain = bbr_pacing_gain[bbr->cycle_idx]; + bbr->pacing_gain = bbr->lt_use_bw ? BBR_UNIT : + bbr_pacing_gain[bbr->cycle_idx]; } /* Gain cycling: cycle pacing gain to converge to fair share of available bw. */ @@ -490,8 +491,7 @@ static void bbr_update_cycle_phase(struct sock *sk, { struct bbr *bbr = inet_csk_ca(sk); - if ((bbr->mode == BBR_PROBE_BW) && !bbr->lt_use_bw && - bbr_is_next_cycle_phase(sk, rs)) + if (bbr->mode == BBR_PROBE_BW && bbr_is_next_cycle_phase(sk, rs)) bbr_advance_cycle_phase(sk); }