From patchwork Tue Mar 10 21:17:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 448718 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 1A971140146 for ; Wed, 11 Mar 2015 08:17:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=google.com header.i=@google.com header.b=jMybaQYe; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753212AbbCJVRL (ORCPT ); Tue, 10 Mar 2015 17:17:11 -0400 Received: from mail-yk0-f179.google.com ([209.85.160.179]:40017 "EHLO mail-yk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbbCJVRK (ORCPT ); Tue, 10 Mar 2015 17:17:10 -0400 Received: by ykq142 with SMTP id 142so2046002ykq.7 for ; Tue, 10 Mar 2015 14:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=DjBl3VvJbQ9KYFiHWm0AVJZu4cV9z4rk1dTIafvnVcA=; b=jMybaQYeEi5J22KY6O4pGP0RXOHF5yIxZ9xyElUG7CUOjHpvwnpTkfqxTpQCm/osmW dfuoDvsaPtEnEK0Z04pXBzLbNcdUeU5KlWv52KxSWxO5+6/DvosRoaUBXD0EFmoqqRVu +5uTRI2mffywb40/cqou3Gyuu5N1uDeb0mkL4GrZASumEtvI/GQjiGv/sNTcLbgpZwGI JG+LYi5tXNdK9EvWKzks9TE0Qz2DiJPjHCuYOqyS3UKT5JMYjix7Pk8MrQAjvml7Zce3 +ClHHB9gqjcsdDa2PpoeNsi7iUE3+umDR5wMZ2cRyUL0bYdsYpO8jFwVqgNQLeZ5qF9P n87g== 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; bh=DjBl3VvJbQ9KYFiHWm0AVJZu4cV9z4rk1dTIafvnVcA=; b=bskw05vpNyZtSwg5FiLtqjbR6btSlQv/xTdPmjRW7TTaB0IGspoEp6QOvCPx2n0Yqv uQWWwgfGx9I6d7mw7wYTz1SSeuxX4j9eKVttstvWbtz0/AurHRBsWvdKvmIRPahBMXl9 s5Zj1raU1nMziLZvkCtDCWmZdqEkAf5wQfGUjHjG1u82kwMIyQvI55bHgN/8pUAKzfT7 SizNT3RMeVwG3zSVjdCg/0+R9pKywS9uMrrc1D7dSbgjuUffh3E5D9U5Y39VlS0acp5v a4UhtZMJ8ErdFP27VNIORHINQH6FgSR8Ye5aflawoGnGqnOjLGMeiCCnTmsZ3C8HxeWs 44cA== X-Gm-Message-State: ALoCoQn8n3wReWwzIiaFDHMV3dsEr1THBwFrEXB3rJHaeT8jTuuiPXs3a//Jz3/kFdVsVfPa4uic X-Received: by 10.170.41.16 with SMTP id 16mr36256461ykj.85.1426022229993; Tue, 10 Mar 2015 14:17:09 -0700 (PDT) Received: from coy.nyc.corp.google.com ([172.26.105.221]) by mx.google.com with ESMTPSA id c41sm1339154yhc.53.2015.03.10.14.17.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Mar 2015 14:17:08 -0700 (PDT) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Neal Cardwell , Yuchung Cheng , Eric Dumazet Subject: [PATCH net 1/2] tcp: fix tcp_cong_avoid_ai() credit accumulation bug with decreases in w Date: Tue, 10 Mar 2015 17:17:03 -0400 Message-Id: <1426022224-28793-1-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The recent change to tcp_cong_avoid_ai() to handle stretch ACKs introduced a bug where snd_cwnd_cnt could accumulate a very large value while w was large, and then if w was reduced snd_cwnd could be incremented by a large delta, leading to a large burst and high packet loss. This was tickled when CUBIC's bictcp_update() sets "ca->cnt = 100 * cwnd". This bug crept in while preparing the upstream version of 814d488c6126. Testing: This patch has been tested in datacenter netperf transfers and live youtube.com and google.com servers. Fixes: 814d488c6126 ("tcp: fix the timid additive increase on stretch ACKs") Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet --- net/ipv4/tcp_cong.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index d694088..62856e1 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -378,6 +378,12 @@ EXPORT_SYMBOL_GPL(tcp_slow_start); */ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) { + /* If credits accumulated at a higher w, apply them gently now. */ + if (tp->snd_cwnd_cnt >= w) { + tp->snd_cwnd_cnt = 0; + tp->snd_cwnd++; + } + tp->snd_cwnd_cnt += acked; if (tp->snd_cwnd_cnt >= w) { u32 delta = tp->snd_cwnd_cnt / w;