Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp220679ybg; Tue, 2 Jun 2020 22:10:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQOuHQvmedW98HQoWWsXVMtPIZg5LUZot6SVic7BlNdnf/mnYAuNJWGG7n2wSZ4bVLnjoP X-Received: by 2002:a17:906:17c1:: with SMTP id u1mr27886609eje.47.1591161002020; Tue, 02 Jun 2020 22:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591161002; cv=none; d=google.com; s=arc-20160816; b=BPgHmoxhj3aGNpf7CsoXuHVPUkRqMrnlOua0a9HIEZ033Yg5K2hSGnYbBGxjTWa2wl brBLYOo+wwZE47WXVRDmfpAqW8fluBYCgHX2beDH0KEUO2IYFJhQ/Ber58qjUKQ1o2Zt F9E/FLCv9GUS2C5YjHbMTMcRU3A+vgUl699Dooak75bkj4m8j+Anoawc3jCorjG4U88g 2ZIWsyujdteZxyb0m8Mr6qd7C0hh3UqSKRHvShmBWBVwAqAkPkdfm9XqA5+htUNKSZJC Po6CImxN3XNyZl4i4cU/OtfC0ApF4Qaus47/VzLs0il53ohXgoszwzCO0VteQVUCo8vn wxYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cJyqSf+S/kkiuR8jlqaM5ACA5juCm28yi6KSRgY87Jo=; b=HsnYN/MlqSb+fnnfDue+YMG8d7saENUgBZMvrq62YVpEMcDpVTsX+413QZnKlx//v9 aFRNBV9NN8rb4Rr9C9KQaAs/qKxRpuFmtlxIFYSPdOiiLuGXbgS6tgko326K2MxNYkgh C3+m6XPdPrnNoAg6AuZ12yxCKkmj/odwVIMj/H/nTlI2elgfEnibwVusqtoV1wctL12s PjXw+6f+H/5wDckQ910uwsLoWEwrAOf0YknSl2VxGHX3Op0Mdi/FHFRDQlkLSq2XPGD8 jpJ8716pQYfIAYxP1a93qoFKCm4EjA6OWhB98xTyQJN5j3ZqfbPniFj9UUw8n/Sda5/k o6HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LB6Su5bC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p27si558571eji.153.2020.06.02.22.09.39; Tue, 02 Jun 2020 22:10:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LB6Su5bC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725906AbgFCFFo (ORCPT + 99 others); Wed, 3 Jun 2020 01:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgFCFFo (ORCPT ); Wed, 3 Jun 2020 01:05:44 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31CEC05BD43; Tue, 2 Jun 2020 22:05:43 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id z206so469525lfc.6; Tue, 02 Jun 2020 22:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cJyqSf+S/kkiuR8jlqaM5ACA5juCm28yi6KSRgY87Jo=; b=LB6Su5bCu23bD/EWMNFe32yZlC81ypLGMWUTTkkVGGkiaM/Ld0gD3yyLGghMihDcAQ 1gnigEsR09fOJTCebUgWv+WTUXuCaVKA6LGVLnHNnKXe1Yvs+kPZQ2Ga+nKoryViZYHY FnyOABaOTOQqn0rqXUKOeJWBcr7bYEShG2LgRczDOggb+0JElBUWpdW2p7ktCPrI4LPB ZnQcmtFEKzh8ep8IUUnemJKwfwW/MJnGqCv3Ve4Gm+eT7gjjITtSpTg9RSzIm5CtcbrO +PZV1Y/HJVSCN5EStlN2hozeusdlSd1iRsydaJgZhhIiRo5Bj9kMFUZdqS5jQAQSIjIa pPuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cJyqSf+S/kkiuR8jlqaM5ACA5juCm28yi6KSRgY87Jo=; b=hTxm898wSLxNKKWp4GhLmK2T9Vvd4cRgueXWgE01iUvDL5U+yR8z0X6xZpQOwmupeA 70uYuDrjTb5CrRXR5SlnmshyUMjCXH1IOKwmEk7Chf7WIVsfYhSDEOMoIwMUmLOssZ2U hXmGnhPTdY9f8ZGonfRim7WEYNGm9XvKFvq19WClxoA8hxIIPvQUSUVBeh1jOV50SQjD OxW/TGORxCj2P+1VU8oh1cbd3evqL4BE1AgdL67FFS+ETOjbBxDNPHcR2f/JgXezOG40 T2gUHHMiL6r3ls+HsGEtOt3qeUDcVqxTeDbCbjhY3cYR3qF1WKIk3SmpBD7mWw2nW5KH 3UUQ== X-Gm-Message-State: AOAM533Z0+8U26/wpd6BxkKjov+drEuxKd0mMLm8opvVvFA+afb947Ra q3rE1lv9DBtdVkN8ISb6sH7QK/L2e00jBjiXMxc= X-Received: by 2002:ac2:55b2:: with SMTP id y18mr1423165lfg.55.1591160742095; Tue, 02 Jun 2020 22:05:42 -0700 (PDT) MIME-Version: 1.0 References: <20200602080425.93712-1-kerneljasonxing@gmail.com> In-Reply-To: From: Jason Xing Date: Wed, 3 Jun 2020 13:05:05 +0800 Message-ID: Subject: Re: [PATCH] tcp: fix TCP socks unreleased in BBR mode To: Eric Dumazet Cc: David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev , LKML , liweishi@kuaishou.com, Shujin Li Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, I'm still trying to understand what you're saying before. Would this be better as following: 1) discard the tcp_internal_pacing() function. 2) remove where the tcp_internal_pacing() is called in the __tcp_transmit_skb() function. If we do so, we could avoid 'too late to give up pacing'. Meanwhile, should we introduce the tcp_wstamp_ns socket field as commit (864e5c090749) does? Thanks, Jason On Wed, Jun 3, 2020 at 10:44 AM Eric Dumazet wrote: > > On Tue, Jun 2, 2020 at 7:42 PM Jason Xing wrote: > > > > I agree with you. The upstream has already dropped and optimized this > > part (commit 864e5c090749), so it would not happen like that. However > > the old kernels like LTS still have the problem which causes > > large-scale crashes on our thousands of machines after running for a > > long while. I will send the fix to the correct tree soon :) > > If you run BBR at scale (thousands of machines), you probably should > use sch_fq instead of internal pacing, > just saying ;) > > > > > > Thanks again, > > Jason > > > > On Wed, Jun 3, 2020 at 10:29 AM Eric Dumazet wrote: > > > > > > On Tue, Jun 2, 2020 at 6:53 PM Jason Xing wrote: > > > > > > > > Hi Eric, > > > > > > > > I'm sorry that I didn't write enough clearly. We're running the > > > > pristine 4.19.125 linux kernel (the latest LTS version) and have been > > > > haunted by such an issue. This patch is high-important, I think. So > > > > I'm going to resend this email with the [patch 4.19] on the headline > > > > and cc Greg. > > > > > > Yes, please always give for which tree a patch is meant for. > > > > > > Problem is that your patch is not correct. > > > In these old kernels, tcp_internal_pacing() is called _after_ the > > > packet has been sent. > > > It is too late to 'give up pacing' > > > > > > The packet should not have been sent if the pacing timer is queued > > > (otherwise this means we do not respect pacing) > > > > > > So the bug should be caught earlier. check where tcp_pacing_check() > > > calls are missing. > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > Jason > > > > > > > > On Tue, Jun 2, 2020 at 9:05 PM Eric Dumazet wrote: > > > > > > > > > > On Tue, Jun 2, 2020 at 1:05 AM wrote: > > > > > > > > > > > > From: Jason Xing > > > > > > > > > > > > TCP socks cannot be released because of the sock_hold() increasing the > > > > > > sk_refcnt in the manner of tcp_internal_pacing() when RTO happens. > > > > > > Therefore, this situation could increase the slab memory and then trigger > > > > > > the OOM if the machine has beening running for a long time. This issue, > > > > > > however, can happen on some machine only running a few days. > > > > > > > > > > > > We add one exception case to avoid unneeded use of sock_hold if the > > > > > > pacing_timer is enqueued. > > > > > > > > > > > > Reproduce procedure: > > > > > > 0) cat /proc/slabinfo | grep TCP > > > > > > 1) switch net.ipv4.tcp_congestion_control to bbr > > > > > > 2) using wrk tool something like that to send packages > > > > > > 3) using tc to increase the delay in the dev to simulate the busy case. > > > > > > 4) cat /proc/slabinfo | grep TCP > > > > > > 5) kill the wrk command and observe the number of objects and slabs in TCP. > > > > > > 6) at last, you could notice that the number would not decrease. > > > > > > > > > > > > Signed-off-by: Jason Xing > > > > > > Signed-off-by: liweishi > > > > > > Signed-off-by: Shujin Li > > > > > > --- > > > > > > net/ipv4/tcp_output.c | 3 ++- > > > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c > > > > > > index cc4ba42..5cf63d9 100644 > > > > > > --- a/net/ipv4/tcp_output.c > > > > > > +++ b/net/ipv4/tcp_output.c > > > > > > @@ -969,7 +969,8 @@ static void tcp_internal_pacing(struct sock *sk, const struct sk_buff *skb) > > > > > > u64 len_ns; > > > > > > u32 rate; > > > > > > > > > > > > - if (!tcp_needs_internal_pacing(sk)) > > > > > > + if (!tcp_needs_internal_pacing(sk) || > > > > > > + hrtimer_is_queued(&tcp_sk(sk)->pacing_timer)) > > > > > > return; > > > > > > rate = sk->sk_pacing_rate; > > > > > > if (!rate || rate == ~0U) > > > > > > -- > > > > > > 1.8.3.1 > > > > > > > > > > > > > > > > Hi Jason. > > > > > > > > > > Please do not send patches that do not apply to current upstream trees. > > > > > > > > > > Instead, backport to your kernels the needed fixes. > > > > > > > > > > I suspect that you are not using a pristine linux kernel, but some > > > > > heavily modified one and something went wrong in your backports. > > > > > Do not ask us to spend time finding what went wrong. > > > > > > > > > > Thank you.