Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1289255pxb; Fri, 21 Jan 2022 14:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJytyEKR0O/tPs4DXkf1Y2H4WOXRiMNaV/hvR4Dk16KGqevm21YLZ1k1bJnmJifojZROVveO X-Received: by 2002:a17:902:7009:b0:14b:ce9:80b0 with SMTP id y9-20020a170902700900b0014b0ce980b0mr5608525plk.97.1642804119002; Fri, 21 Jan 2022 14:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642804118; cv=none; d=google.com; s=arc-20160816; b=a/Ogrs+f9/gK8QL3vlfzpwmKqZp6jrGOfNDDlNAx6IZVGGlqJz5/gMF/XFBKQ3uArl tlhnqs+/eHWHlvo+79MO3BkmziLLCrETQoJrvar8LojNkjmbs7pe4N8gihLq6JXf4aHO WcI9u4CoEFJRy9uq3Pxwtwjik3idXUgAdr47it6kZvuebAuhzNZVfI959iz7a2VBhefS CdgNaImhytDLwo6AtHL4gbRmKu9MIO7+0R63PTBYgiEyQJ36zrc+XWoG/kuDjRzwv6hf o21kF16ZCyyfmeDMcomgVNhVv7c2KdxY2/LLo7JIquZ/jUXMZ3iqlcAR4PEm9hYT5zHx dMzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nWuQlNh1+FFK77BDf2dM2joOBNRuxhXU9eZ1lL6RJ9U=; b=gdp7qKfD1ARBNfh+HDgLHZP1CWHyR1ofG2jrJP1f9ogAOFszsRsjqiLA7MZjmD/yTZ z1Yd1tzXFw7i90o8ZnFyj4afRZU/Idw/W7rxqz+EEp9WwVUf14ilZuEA+3Covqa6Po6M Kmxhwg+xzlQN5cg6JEMB1JGgKw76gH3mfNuaPWuNmEdDmqfe3/UQGLKihfiX1SF0WKxm Rz4o3mYmrtxlzAg5Q3VdsXi+S09rmZPLgWf+pwH3G/ITKpvxl5mQGDPqe0UF6sK6b8NN YPo5B8wthSs3FyLumcy19odA0d7CBrPI9QEuPPsd0DYzZbRMLbtkP346a6L09wNyC1vN GMpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="Vt1BML/8"; 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=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m123si6772258pgm.478.2022.01.21.14.28.25; Fri, 21 Jan 2022 14:28:38 -0800 (PST) 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=@cloudflare.com header.s=google header.b="Vt1BML/8"; 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=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbiATRaf (ORCPT + 99 others); Thu, 20 Jan 2022 12:30:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiATRaF (ORCPT ); Thu, 20 Jan 2022 12:30:05 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C1E4C06173F for ; Thu, 20 Jan 2022 09:30:04 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id t18so5709304plg.9 for ; Thu, 20 Jan 2022 09:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nWuQlNh1+FFK77BDf2dM2joOBNRuxhXU9eZ1lL6RJ9U=; b=Vt1BML/8C1w1Q+B4uH6TEBe5Bp0XbsvPs4rQ6vDbh4AQAMJsx6vpR/THGjnP986NTs 4d1TEV4riAkWtTWI+l1jErkyQaKUeVe8WtypsjRoeZgbZXQIZ+pX7nRZnQ7iTfTU9B2y BtUyTG8OcdTCpFbU/VnEt3Wh9cjUEYvkCPXzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nWuQlNh1+FFK77BDf2dM2joOBNRuxhXU9eZ1lL6RJ9U=; b=1/SQEJOLacF+MRty2uujzKfncgJmiB2ogwYfS38EdWopVw6NUCWzCBiiArXntGUZR6 UxirJ5Ba+Y6C6v96oe+gdUf/3krY2JIui2/0PHekyqKsIei4uPWTjFfZRS27xkj9cu3Z YpCrIKlrAMcWo2oPi0FL4uhPZ0BN9rgx1GYaDbXRT/kZJcLG7BTxZjKrk4n6uxGFBlmB w9OSgAZ/litNmCyvpl3ScCoGz30Q76PBNWiqEuypVopxFd17jvGMntsWr14R405l4dlN 82crtE3IHZLf5pdIlmi2oRu7jz3ivcy0TwtbphXbBQ03DxmtRUWQ881v/17Ow/dy9i7t 4Nsg== X-Gm-Message-State: AOAM531PJyRiSK58DneTTaNAnHJKX3ys217v8ZY5oS4Yqt61AUuJMlgK N33H5sCZ0OBOc2XeMoSHJoqOXA8LEkmcJvzTgeXYbw== X-Received: by 2002:a17:902:8208:b0:14a:c442:8ca2 with SMTP id x8-20020a170902820800b0014ac4428ca2mr27948pln.12.1642699803642; Thu, 20 Jan 2022 09:30:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Daniel Dao Date: Thu, 20 Jan 2022 17:29:52 +0000 Message-ID: Subject: Re: Expensive tcp_collapse with high tcp_rmem limit To: Eric Dumazet Cc: netdev , kernel-team , linux-kernel , David Miller , Jakub Kicinski , Hideaki YOSHIFUJI , Marek Majkowski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 6, 2022 at 6:55 PM Eric Dumazet wrote: > > On Thu, Jan 6, 2022 at 10:52 AM Eric Dumazet wrote: > > > I think that you should first look if you are under some kind of attack [1] > > > > Eventually you would still have to make room, involving expensive copies. > > > > 12% of 16MB is still a lot of memory to copy. > > > > [1] Detecting an attack signature could allow you to zap the socket > > and save ~16MB of memory per flow. Sorry for the late reply, we spent more time over the past weeks to gather more data. > tid 0: rmem_alloc=16780416 sk_rcvbuf=16777216 rcv_ssthresh=2920 > tid 0: advmss=1460 wclamp=4194304 rcv_wnd=450560 > tid 0: len=3316 truesize=15808 > tid 0: len=4106 truesize=16640 > tid 0: len=3967 truesize=16512 > tid 0: len=2988 truesize=15488 > > I think that you should first look if you are under some kind of attack [1] This and indeed the majority of similar occurrences come from a websocket origin that can emit a large flow of tiny packets. As the tcp_collapse hiccups occur in a proxy node, we think that a combination of slow / unresponsive clients and the websocket traffic can trigger this. We made a workaround to clamp the websocket's rcvbuf to a smaller value and it reduces the peak latency of tcp_collapse as we no longer need to collapse up to 16MB. > What kind of NIC driver is used on your host ? We are running mlx5 > Except that you would still have to parse the linear list. Most of the time when we see a high value of tcp_collapse, the bloated skb is almost always at the top of the list. I guess the client is already unresponsive so the flow is full of bloated skbs. I would rather not having to spend too much time collapsing these skbs.