From patchwork Thu Mar 11 20:35:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 398159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1F1FC433E6 for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C26B64F8C for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231234AbhCKUgL (ORCPT ); Thu, 11 Mar 2021 15:36:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhCKUfu (ORCPT ); Thu, 11 Mar 2021 15:35:50 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E14C061574 for ; Thu, 11 Mar 2021 12:35:50 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id 18so341602pfo.6 for ; Thu, 11 Mar 2021 12:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EM9m5r1jnvP1QElpZ6X50oQX5qBOeqTxmC+ieY+4/Mk=; b=R8pCDqfPbu2JdixRvvg6+IRlH7vCwYR5aFZ0yHNvvmphuU0WpeqSq9SC+pmHfKGBK/ dkQA962ni3RiBcTgGWcQUqFvD3vBZaR+1nbLquQaIMrpVw4OZBPttXd1l5UQVDaQsjyu zQH6Ig/x8hySzCWzUEDy0KR8gRzskO2CaWhm+vkjSHIaTF9O3FzPJNxSPiC97OF97bWe gGI3jwNfdDjBdEOiewuTuViahUo7rqPTvBWgv/C7k8x2BNCQqpL9nONwRgCva5wnHO6r s+t52wz4BOn4TX9A3OWgYP1URdn8MUsy1sQlamtzt2BM7JXJnErsYRGp7CHv685g9k16 DVPw== 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=EM9m5r1jnvP1QElpZ6X50oQX5qBOeqTxmC+ieY+4/Mk=; b=Xx40Zw77Wz7qBTWs6YGoN7Due4t40XePIr180NSuC7yM6vXlT/3VOiS+Nz4pFrT3os 9ZvVvj98f0CZycXSxe7GiLubJNpc5FNPkM/9if7Vm6E5MAAG2UyXanuwI1Z2FuHT8kYt CbE4wt2OQhFaoZVDQLbMdPuuEfDpFWOVfm7G8iktX0P3N4MuaBTxTa9Db/oFcr2kJNhY YTte6mGYhdgKa1J3eEmwdoaAe6jAhlMG7ZKZC/vOsHjAGy4R7NsRKWXSQcJZVZTc7zFP 68+gsD7Sqp74Ls1PiLQKUB7NwThX+ILvmjNT29IRoduSHhE3NneYZ0pbtRuYgFBjccHO b3mg== X-Gm-Message-State: AOAM531leO4dTMTKqE79sFYaU60WVByem2gU7FS0H6j9cJt3pYokjwiP 1+8B5QXT323ML3VyJDmsHC2MfNI17ug= X-Google-Smtp-Source: ABdhPJwadOdHGoT/ygUbfZ8n71Xl0YxIbD2Dmx1ZEpIv/krKn9bKqtgNVQlXnXyWtfWx8K1ND29j7A== X-Received: by 2002:aa7:9281:0:b029:1ec:48b2:811c with SMTP id j1-20020aa792810000b02901ec48b2811cmr9176269pfa.18.1615494950071; Thu, 11 Mar 2021 12:35:50 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:5186:d796:2218:6442]) by smtp.gmail.com with ESMTPSA id 25sm3232745pfh.199.2021.03.11.12.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 12:35:49 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Eric Dumazet , Neal Cardwell , Yuchung Cheng , Neil Spring Subject: [PATCH net-next 1/3] tcp: plug skb_still_in_host_queue() to TSQ Date: Thu, 11 Mar 2021 12:35:04 -0800 Message-Id: <20210311203506.3450792-2-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311203506.3450792-1-eric.dumazet@gmail.com> References: <20210311203506.3450792-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet Jakub and Neil reported an increase of RTO timers whenever TX completions are delayed a bit more (by increasing NIC TX coalescing parameters) Main issue is that TCP stack has a logic preventing a packet being retransmit if the prior clone has not yet been orphaned or freed. This logic came with commit 1f3279ae0c13 ("tcp: avoid retransmits of TCP packets hanging in host queues") Thankfully, in the case skb_still_in_host_queue() detects the initial clone is still in flight, it can use TSQ logic that will eventually retry later, at the moment the clone is freed or orphaned. Signed-off-by: Eric Dumazet Reported-by: Neil Spring Reported-by: Jakub Kicinski Cc: Neal Cardwell Cc: Yuchung Cheng --- include/linux/skbuff.h | 2 +- net/ipv4/tcp_output.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 0503c917d77301f433122bf34a659bb855763144..483e89348f78b48235748de37ae3ea7ec9450491 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1140,7 +1140,7 @@ static inline bool skb_fclone_busy(const struct sock *sk, return skb->fclone == SKB_FCLONE_ORIG && refcount_read(&fclones->fclone_ref) > 1 && - fclones->skb2.sk == sk; + READ_ONCE(fclones->skb2.sk) == sk; } /** diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index fbf140a770d8e21b936369b79abbe9857537acd8..0dbf208a4f2f17c630084e87f4a9a2ad0dc24168 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2775,13 +2775,17 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto) * a packet is still in a qdisc or driver queue. * In this case, there is very little point doing a retransmit ! */ -static bool skb_still_in_host_queue(const struct sock *sk, +static bool skb_still_in_host_queue(struct sock *sk, const struct sk_buff *skb) { if (unlikely(skb_fclone_busy(sk, skb))) { - NET_INC_STATS(sock_net(sk), - LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); - return true; + set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags); + smp_mb__after_atomic(); + if (skb_fclone_busy(sk, skb)) { + NET_INC_STATS(sock_net(sk), + LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); + return true; + } } return false; } From patchwork Thu Mar 11 20:35:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 398160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC840C433E0 for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CBD064F85 for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbhCKUgM (ORCPT ); Thu, 11 Mar 2021 15:36:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbhCKUfx (ORCPT ); Thu, 11 Mar 2021 15:35:53 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12C19C061574 for ; Thu, 11 Mar 2021 12:35:53 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id q5so1762334pgk.5 for ; Thu, 11 Mar 2021 12:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xXyWNZ0PgxUeV/fSkM7g3dWQRQWscdwMGs9fFM2ZZzY=; b=XOYkC3egtbvg+RnRkDZVqC16nIPjvXWcrs9fPgeba22gI+3NPKaNUAX1zgqDho+CJY MPdUUz2RfVhinhun3pf8voFD+T5Bx2wtGFkrgVPoikUi97WI8rXbyKNgXOUbAYmyDXur pvQxV4+ZBRmqZD8DupSrvonctLzJJntiYmX5uzJGEDEHXmY0EfpmbkYrMbkHcjCu+BKe CROYJYMhaAcrhVAe0rNlFjbS6laIUVWvTWsOTz+K8XTZ+MfNfpgSlzGgCWApKWb/bFgt 16oGwHEGvGd9znS7CGUKjomi7C6KGtq1mdfMWpk4cfI9Ee3wA9sPLZcltBj9LtGv4hWP d3MQ== 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=xXyWNZ0PgxUeV/fSkM7g3dWQRQWscdwMGs9fFM2ZZzY=; b=MEh33VKnqJcKnasX4fpSgtBNFlPEbC3TMMyekYpXkfHZ2/+ZuIyf+lFNfdbfjAFMCv LUaVq4X3kMdPdqKfQps4htmycUPGHr5hThRWTl0fQHkz81Io8nEdDWkdxUD8oBo3VRum EkWtQ9W4g2mCfXsf0SbyP9Y+7kMzPXUa4X8vO6wmVqCB+QeXpqYosCvooFX4op+NdAWW zyMCoS3Z+tSQhtZea3CxS6QeIgnJQ1VQt5PapO33RM475ltHRkYsI+o3wb3LBcA6S15t yUUevWxG5Irp56+tckNoyBbPvUxREx086xbw8rabMjuPHYI+MGu0Je9vhmn27zTx7NTS NEaw== X-Gm-Message-State: AOAM532swEXINmIU3oiAYrzDa2GMlZABfosff+vh0U6zEjO/CMk6QLcI rOI/wFiKWhwJGu/SfKusTx4= X-Google-Smtp-Source: ABdhPJzpnPJXwngsBmYFpASkG3ie8LEIl0ak6V7UM37bM9hETYA6XOhHkn+6G0K/z2dHJRUHbvbhbQ== X-Received: by 2002:a62:3c4:0:b029:1ee:9771:2621 with SMTP id 187-20020a6203c40000b02901ee97712621mr9082176pfd.47.1615494952640; Thu, 11 Mar 2021 12:35:52 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:5186:d796:2218:6442]) by smtp.gmail.com with ESMTPSA id 25sm3232745pfh.199.2021.03.11.12.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 12:35:52 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Eric Dumazet , Neal Cardwell , Yuchung Cheng , Neil Spring Subject: [PATCH net-next 2/3] tcp: consider using standard rtx logic in tcp_rcv_fastopen_synack() Date: Thu, 11 Mar 2021 12:35:05 -0800 Message-Id: <20210311203506.3450792-3-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311203506.3450792-1-eric.dumazet@gmail.com> References: <20210311203506.3450792-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet Jakub reported Data included in a Fastopen SYN that had to be retransmit would have to wait for an RTO if TX completions are slow, even with prior fix. This is because tcp_rcv_fastopen_synack() does not use standard rtx logic, meaning TSQ handler exits early in tcp_tsq_write() because tp->lost_out == tp->retrans_out Lets make tcp_rcv_fastopen_synack() use standard rtx logic, by using tcp_mark_skb_lost() on the skb thats needs to be sent again. Not this raised a warning in tcp_fastretrans_alert() during my tests since we consider the data not being aknowledged by the receiver does not mean packet was lost on the network. Signed-off-by: Eric Dumazet Reported-by: Jakub Kicinski Cc: Neal Cardwell Cc: Yuchung Cheng --- net/ipv4/tcp_input.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 69a545db80d2ead47ffcf2f3819a6d066e95f35d..4cf4dd532d1c65bba417a66ba6b7783491b6380a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2914,7 +2914,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, /* D. Check state exit conditions. State can be terminated * when high_seq is ACKed. */ if (icsk->icsk_ca_state == TCP_CA_Open) { - WARN_ON(tp->retrans_out != 0); + WARN_ON(tp->retrans_out != 0 && !tp->syn_data); tp->retrans_stamp = 0; } else if (!before(tp->snd_una, tp->high_seq)) { switch (icsk->icsk_ca_state) { @@ -5994,11 +5994,9 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, tp->fastopen_client_fail = TFO_SYN_RETRANSMITTED; else tp->fastopen_client_fail = TFO_DATA_NOT_ACKED; - skb_rbtree_walk_from(data) { - if (__tcp_retransmit_skb(sk, data, 1)) - break; - } - tcp_rearm_rto(sk); + skb_rbtree_walk_from(data) + tcp_mark_skb_lost(sk, data); + tcp_xmit_retransmit_queue(sk); NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVEFAIL); return true; From patchwork Thu Mar 11 20:35:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 399459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEC33C433E9 for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B99164F91 for ; Thu, 11 Mar 2021 20:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231244AbhCKUgN (ORCPT ); Thu, 11 Mar 2021 15:36:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbhCKUfz (ORCPT ); Thu, 11 Mar 2021 15:35:55 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B9AC061574 for ; Thu, 11 Mar 2021 12:35:55 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so3747881pjb.1 for ; Thu, 11 Mar 2021 12:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h8XVbQKdXCWJQp+umGqqBJDYSqgM/CA/nG8vr+0C1eI=; b=n/cnfUpru2OKNmHrzw+FfXNRavHTpJBic0/dX96BvTsAR/QF2/GBX4PVb0s7uHiGhj GuKmhjDZcYfReQcydiNpHw9pKJ3xLKDJTfONsu7afATM/aeyR//WoXQtGqxg3UDgIiHX bI6a0TIpjsSLPGUKndpvebCURwcQPs28gBFWD9Vuih4UUFY4qt72qWBVsQdQm4PPmOjz 1SlFRHdtZpIIkgxekSPJFOfLYbCXaF/MYd96Kxk+Py3gbfJ3l17SjM1f2SScMyhqiRxx E1Pm9Z3810WRrp8gpcUcoRdGi2OhXimEOlv0guUm3gMn3U8omhTEsB3hHxy+p7784hfA RxRg== 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=h8XVbQKdXCWJQp+umGqqBJDYSqgM/CA/nG8vr+0C1eI=; b=udZ0/9aNWgYsTHDPM4dUVO5MsfOU5JpciVYpY6w7gzf7GSGK2HSrmKdTeB2+kAinNA G/uuoO/oHnn+OSYIWdDtNcKduk4WAcnSWWVQvIXa7Ti7g6OVqm+VHXDC33k5m56tUh2W 3FZhneY0PSPi7+On07dkFz5r21uG9JN647YIBdvdsAXi+mmoAkYlnSwVX2obH0pW/o13 oJHr0/lIq10ME7qiAoILJmdBa1kxlPzRO+ZpHxYdbF0B2bxGBys4oqGCNIC8t8bQL+SM nL54Oo6a1d9cSfyVfRkKq6m/yMBZ8LbM9c7l0KxQmeCn/5Fp+v8lxaVYgOSTdd5KXHlq M7jg== X-Gm-Message-State: AOAM532zXKAWxYm1drslk26zHbrYEds/5tVJ9+87/vg5ipWJIQfj9IDV XgtZb4FVQy9DDc25wehemJY= X-Google-Smtp-Source: ABdhPJx0oSWkTIcVePmOGr3MP7l1aUvnjfFLGi3jRFhoD18Xd/+7p+YI0ELxSFW+uCwIujpdMG4UYQ== X-Received: by 2002:a17:902:d64d:b029:de:8aaa:d6ba with SMTP id y13-20020a170902d64db02900de8aaad6bamr9858688plh.0.1615494955254; Thu, 11 Mar 2021 12:35:55 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:5186:d796:2218:6442]) by smtp.gmail.com with ESMTPSA id 25sm3232745pfh.199.2021.03.11.12.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 12:35:54 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Eric Dumazet , Neal Cardwell , Yuchung Cheng , Neil Spring Subject: [PATCH net-next 3/3] tcp: remove obsolete check in __tcp_retransmit_skb() Date: Thu, 11 Mar 2021 12:35:06 -0800 Message-Id: <20210311203506.3450792-4-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311203506.3450792-1-eric.dumazet@gmail.com> References: <20210311203506.3450792-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet TSQ provides a nice way to avoid bufferbloat on individual socket, including retransmit packets. We can get rid of the old heuristic: /* Do not sent more than we queued. 1/4 is reserved for possible * copying overhead: fragmentation, tunneling, mangling etc. */ if (refcount_read(&sk->sk_wmem_alloc) > min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), sk->sk_sndbuf)) return -EAGAIN; This heuristic was giving false positives according to Jakub, whenever TX completions are delayed above RTT. (Ack packets are processed by TCP stack before clones are orphaned/freed) Signed-off-by: Eric Dumazet Reported-by: Jakub Kicinski Cc: Neal Cardwell Cc: Yuchung Cheng --- net/ipv4/tcp_output.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 0dbf208a4f2f17c630084e87f4a9a2ad0dc24168..bde781f46b41a5dd9eb8db3fb65b45d73e592b4b 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3151,14 +3151,6 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) if (icsk->icsk_mtup.probe_size) icsk->icsk_mtup.probe_size = 0; - /* Do not sent more than we queued. 1/4 is reserved for possible - * copying overhead: fragmentation, tunneling, mangling etc. - */ - if (refcount_read(&sk->sk_wmem_alloc) > - min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), - sk->sk_sndbuf)) - return -EAGAIN; - if (skb_still_in_host_queue(sk, skb)) return -EBUSY;