From patchwork Wed Jan 16 23:05:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 1026256 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="viWqKFdo"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43g2rF0rnYz9sBQ for ; Thu, 17 Jan 2019 10:06:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387989AbfAPXGD (ORCPT ); Wed, 16 Jan 2019 18:06:03 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34060 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387980AbfAPXGC (ORCPT ); Wed, 16 Jan 2019 18:06:02 -0500 Received: by mail-pg1-f194.google.com with SMTP id j10so3507971pga.1 for ; Wed, 16 Jan 2019 15:06:02 -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 :mime-version:content-transfer-encoding; bh=K/4xedm8B8QRpTBv9uVpAUKLNB1iO3Tt0SQWuBHTcl0=; b=viWqKFdoC0n8De8+y7XVrdxMJ0NYLZX3cNKLnssp3pV2KetrhFhKzVkb13O62YTNQy Wrg/626IogCJLYk96LkyiHabntYVCcYnDM5/SwJR3YmIrAUXwG687nRxqojv+O9ByOJ6 nDvRsQV5Dv/YKM2jp4P41N2FN3PvZEKtJeKvHSYRuYa34ZYT1CkRvpVSy2Id3RCgCdSa o9jUSVpPR9ZftuWdw/2K2I33eZ6ZCKDBevB1cHH2ixrNErTUrZU0lvf84eucnP+6QF88 q7zRC8joglezCF3LfGQZg+RWa7MMal8clsRDZGSKtzXYuQ9qENkugXDurbQUI/MekRt8 2Gsw== 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:mime-version:content-transfer-encoding; bh=K/4xedm8B8QRpTBv9uVpAUKLNB1iO3Tt0SQWuBHTcl0=; b=pdjCTtuyqZ9/GTssIM2NnVo04eZ/iqeA2SEZ3pBttyD/gpac8kINRgzvBYeM01hn+C Cq7qfDM2rbY4qfx9nP/DRgGPhmqJVLuMg7+F6sxus4x317av2rUQxe3XVM1DElBcX4+U Hhd1kJ9l/IxEyXePoWlGC8Oqccw+ibjT0yQaIMG5J8jkuULcCbiwR8ZHvK5JJdQcZiSi wcZR1xum00GhkdnH2lLZAzZeErpgVfIF/sE4jZA7JrlkfiKzHiDK6uGkVklQ6OEs6Af6 yo0uNqva6qe04FMxzgGuEBVwLFPRaSHDRTyynGd6NQ4qhoAzPRWicvzQadccOPenUdjU NduQ== X-Gm-Message-State: AJcUukcgMgbbwgbQY7cyCH7EvlC1VylzMRX9j1bGj/tRf+zB20Q8MBkA eBjTMjVQU2aPJDXg7Dem5NZ74w== X-Google-Smtp-Source: ALg8bN6G3QhDpgMzNTgNSOwUEbE3k+gi+JFE1VLxG5NzzmblbMe65+VZOE8q5zAyqP0pTXilZ9lQTQ== X-Received: by 2002:a62:8893:: with SMTP id l141mr12203588pfd.1.1547679961206; Wed, 16 Jan 2019 15:06:01 -0800 (PST) Received: from ycheng2.svl.corp.google.com ([2620:15c:2c4:201:d660:6c0b:8a4f:4c77]) by smtp.gmail.com with ESMTPSA id k186sm8481087pge.13.2019.01.16.15.05.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:06:00 -0800 (PST) From: Yuchung Cheng To: davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, ncardwell@google.com, soheil@google.com, Yuchung Cheng Subject: [PATCH net-next 7/8] tcp: retry more conservatively on local congestion Date: Wed, 16 Jan 2019 15:05:34 -0800 Message-Id: <20190116230535.162758-8-ycheng@google.com> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190116230535.162758-1-ycheng@google.com> References: <20190116230535.162758-1-ycheng@google.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Previously when the sender fails to retransmit a data packet on timeout due to congestion in the local host (e.g. throttling in qdisc), it'll retry within an RTO up to 500ms. In low-RTT networks such as data-centers, RTO is often far below the default minimum 200ms (and the cap 500ms). Then local host congestion could trigger a retry storm pouring gas to the fire. Worse yet, the retry counter (icsk_retransmits) is not properly updated so the aggressive retry may exceed the system limit (15 rounds) until the packet finally slips through. On such rare events, it's wise to retry more conservatively (500ms) and update the stats properly to reflect these incidents and follow the system limit. Note that this is consistent with the behavior when a keep-alive probe is dropped due to local congestion. Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Reviewed-by: Neal Cardwell Reviewed-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_timer.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index c36089aa3515..d7399a89469d 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -500,14 +500,13 @@ void tcp_retransmit_timer(struct sock *sk) tcp_enter_loss(sk); + icsk->icsk_retransmits++; if (tcp_retransmit_skb(sk, tcp_rtx_queue_head(sk), 1) > 0) { /* Retransmission failed because of local congestion, - * do not backoff. + * Let senders fight for local resources conservatively. */ - if (!icsk->icsk_retransmits) - icsk->icsk_retransmits = 1; inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, - min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL), + TCP_RESOURCE_PROBE_INTERVAL, TCP_RTO_MAX); goto out; } @@ -528,7 +527,6 @@ void tcp_retransmit_timer(struct sock *sk) * the 120 second clamps though! */ icsk->icsk_backoff++; - icsk->icsk_retransmits++; out_reset_timer: /* If stream is thin, use linear timeouts. Since 'icsk_backoff' is