Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp157707ybg; Tue, 2 Jun 2020 19:48:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFz81LndApnnO53gWvuMBKFKYsyvqA9W1+8VTLLaSI0iagG3xDFgrQRgEEwZqg3MU73/xt X-Received: by 2002:a17:906:f46:: with SMTP id h6mr24923018ejj.144.1591152511135; Tue, 02 Jun 2020 19:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591152511; cv=none; d=google.com; s=arc-20160816; b=MPURt0rg6zHEyqHIzhF+MCJLbk3GlVKDsJCBv0IBpf+qPXJNiTv7WvDFoXnHLmWHhk GyNyKJ6lX6Zx0PHsovUtgu28Zzvg7iY/CeWubSykiZngHaERH4222MLrM0+W6tLWGpuc dmUv8lHxQHM4aXfzjg+T8pTlR6pELIx4vFYMlKxMn090NOa/hZI82ym7/n5A/GwAyzBz D5kXX8ZCp9+AyGhPY4lMlp7fjFfzlRXydB7a5CxiFOWvXsmfa+Wi/BIEUj6P0Oi0/J/r ni48aAxfkecjexsLS3V5MhnMoiBNdJhIGRuuysNlrUry1ZZiVWQbFfKbvxr94HWN2yxs Xwtg== 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=+dgxTQh3Md4txrn7hnHhPbJC7jZ8erDmqs6r1XjY71Y=; b=xVcjc9iUzSBgisyLXQh/p9I/zRWx2YWNnkgnG6VLYFha2/G2vvwM4cSgg5gMFylPhr kJar9eIziE2lquol8pHScjPWK6b/DDGVJblzcRP+4xz/Cwly8mOPuJRPmf4A9bfMpZVO okK1fRQLRDGywdhYhCu59eqJsKHjRBg/n2fbuiUjcB/5MFqYUPcscBHnXD/q++RpWEpG p2w6RKhpvVnzEg0Q9AQedbeftg34WfV9EhvoI+vwUvtK5hr5BoyXCuVSCSIergeZzo8t FFtlrSiwfOPyILvAPKVNsemiJPLLdmVg1Gy2gQcL+VSS6KfnFKrsZQugfAvwtcxAyalS BTUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LWEWDdog; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq22si378074ejb.685.2020.06.02.19.48.07; Tue, 02 Jun 2020 19:48:31 -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=@google.com header.s=20161025 header.b=LWEWDdog; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725924AbgFCCoQ (ORCPT + 99 others); Tue, 2 Jun 2020 22:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgFCCoN (ORCPT ); Tue, 2 Jun 2020 22:44:13 -0400 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 292A5C08C5C1 for ; Tue, 2 Jun 2020 19:44:12 -0700 (PDT) Received: by mail-yb1-xb42.google.com with SMTP id j8so247609ybj.12 for ; Tue, 02 Jun 2020 19:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+dgxTQh3Md4txrn7hnHhPbJC7jZ8erDmqs6r1XjY71Y=; b=LWEWDdog0PLIePxPYC/qcMr2Z+5wD12p2iU8eCSGIxrWqHCjZs6MlG4TCDgDA2g2dW vHb72hAlYE95JxAp0q0Nk3IOH4AU97jEcmDZt6mQMsZtL2Z+iB33/gwuLy+pRbtvr9sY zGW1w08gMbNrub35uc64KFo6IBZFLh562CUC/5WQ9POx1XHWpjmusI+qVaoD/rKb79Tv Bi96q4ZCBfk1ye28aRgI9/Nlnm02zLOHVLY0Vg6uekHfmXJILoj6xa3bFISdfw84ttyq bcQFDICW0e700j7cE6GFou1BKjSq3hJlMvX+U8loxTgGGtphyC3Du83f3AkS9SUCON+0 iAsQ== 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=+dgxTQh3Md4txrn7hnHhPbJC7jZ8erDmqs6r1XjY71Y=; b=oPcvR3ki1sWuE8EuWV7rcGNJZbNiRAf5D4ZaTaI6vRaSl79mMCg07O4dFQw0gSm4zV 5c0nOtUdn+i/wbYnGsL5tn59FEbFYWwmCBbrnB8HqfqE0rDAlkVw9rmqDkG+bonlcwyQ 0aLne/+mDijPOmcIOdYWvGwXF08+RnAGdgcv2L1WhEmAtS5aJyOEIbKmPE6tLoguf4eP qpFkTiCZiFZJ6QApmmNFIlbj29RBF3o4IyuNRNgVFwXVVNgT/rHUl8zUpSXx43kR2sPN oZiux6V4eoIXLtXpnoxaapSwWp9qeQ1Rhgdt4tpG9de9kE+4Ocoj1a75G7oM5m3So4qT JuZw== X-Gm-Message-State: AOAM532Yf7DI2OSYaO3ISnjIGd+q1wqiHEOmK3aiLaheGk+DITXwWQfq rZsQJ13LO2GKxbRAbcqUYBT7/J4W/Koogvs32B/BIQ== X-Received: by 2002:a25:ec0d:: with SMTP id j13mr6201342ybh.364.1591152251099; Tue, 02 Jun 2020 19:44:11 -0700 (PDT) MIME-Version: 1.0 References: <20200602080425.93712-1-kerneljasonxing@gmail.com> In-Reply-To: From: Eric Dumazet Date: Tue, 2 Jun 2020 19:43:59 -0700 Message-ID: Subject: Re: [PATCH] tcp: fix TCP socks unreleased in BBR mode To: Jason Xing 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 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.