Article View: linux.kernel.netdev
Article #16377Re: [PATCH v1 net-next 7/8] tcp: Batch memory accounting in tcp_collapse().
From: Eric Dumazet
Date: Sat, 14 Nov 2026 15:38
Date: Sat, 14 Nov 2026 15:38
24 lines
9743 bytes
9743 bytes
Le sam. 14 nov. 2026 ร 05:01, Kuniyuki Iwashima <kuniyu@google.com> a รฉcrit :
>
> Once tcp_collapse_one() calls sock_rfree(), skb->truesize is
> reclaimed to sk->sk_forward_alloc by sk_mem_uncharge().
>
> However, sk_mem_uncharge() rounds down sk->sk_forward_alloc
> immediately once it reaches 4K since commit 4890b686f408 ("net:
> keep sk->sk_forward_alloc as small as possible").
>
> This unnecessarily reclaims memory for newly allocated skbs,
> and the following skb_set_owner_r() for them underflows
> sk->sk_forward_alloc without sk_forced_mem_schedule().
>
> Let's cache the delta during tcp_collapse() and batch accounting
> at the end.
>
> Then, we no longer need sk_forced_mem_schedule(), and instead
> DEBUG_NET_WARN_ON_ONCE() is added to catch a future issue.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Technical Details
Message-ID:
<CAL4WiiqY-8011r9W_mGk1ZRZhmO2ac58s0ZiHEtKDyMzYrd1zg@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363345-linux-kernel-netdev=dewy.ruReferences:
<20261114040101.1043546-1-kuniyu@google.com> <20261114040101.1043546-8-kuniyu@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363345-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v1 net-next 7/8] tcp: Batch memory accounting in tcp_collapse(). Date: Sat, 14 Nov 2026 16:38:00 +0100 Organization: Usenet Network Message-ID: <CAL4WiiqY-8011r9W_mGk1ZRZhmO2ac58s0ZiHEtKDyMzYrd1zg@mail.gmail.com> References: <20261114040101.1043546-1-kuniyu@google.com> <20261114040101.1043546-8-kuniyu@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1601812"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:QxfWDVlxC3dxKB49iE39Tm9E0v4= sha256:U+cRp7LMrn/U6xtKA+YtRLZyPaj1FVqn32Junu96e5E= sha1:1qvT6pvnzABjA45kyuxEt+PvLXc= sha256:atlT4di9EV/2L+7QGTX8sg8pPmNaNK7koj/FL7GwX7I= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 7BB0C11485D; Sat, 14 Nov 2026 18:38:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7XbWEk__SoHW; Sat, 14 Nov 2026 18:38:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363345-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 89263114859; Sat, 14 Nov 2026 18:38:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 91637325BA; Sat, 14 Nov 2026 15:38:14 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794670693; b=arnqumCzKaQz2/LK4Wtw0aOUPO3t8yIM7gR2Rvf5zcdm+2T73iKrif4Y3+Vn/SLRBT0m bqmqKf0c+E6DEwrHu9OA/DPxq21AZxKoRd1FyzRO377Nc/BecZRvkeKMRQqmIVIK3vL+o JRL9S7EYvzM4sJ9yvH5dqniogQVxlPZufEuQz3YpruA7iD7FZX4dMP8LwMycGmGZq5k8D 7tjyKo+JM8l5rWrOd9Cmvuxs0SLs2xS4r/tZ3arvz5TC76FSPStygE5YqVjpfamsqhpr1 I94mb8+8rs3Uf7nSyoBzAXoo+eaHDY8IDzaZoQ/5eCrhNvOC/n/TxNyx1BvmCM1MAfA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794670693; h=X-Original-To:Received:Received:DKIM-Signature:Received: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date: X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc: Content-Type:Content-Transfer-Encoding; bh=lZLJy6bzNUWfLiwfp/OHIdREPsKJ7Su3AkHPHH7wh/8=; b=VuB01nMjQwyQI5JYveajh0o+csRG4jFH7lzKYhmky4c0LUJMdE/OmKD/8ho1oAtLF7bX 1Wr11CbxusTpdGXuvxBO4tfuYI1zpfqQv5IySztLg3AOir+ulfM9E37zbv6dTxqLlo6V9 dVhOoJCoKsc0SiLfU22JIFmo8R2lbk/oWYndHc2FSr3SOwWwRZatgsGChZ7ySUU9nPCl8 n9d1YwBq5fZwt7oyULjMCUdeJztvnR+d1ksQepg+DB8dg+Ra9c1vDmNEg1vllaqEfggAj /V4sj2cOymceB0xYZ/SEHJuTFxK3JC/AK5Uk7nozFss/HNAlwtnS/UGPQbDqbBsICug== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J14Na+tt; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB6BA606A333; Sat, 14 Nov 2026 15:38:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J14Na+tt X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794670693; b=xkoKeMulzUvdTxCbp6UATlu34Je+d0ksXOIr00geT9OYlch0sesUvxvNL0sKRPuof/gm AwOm7Chnnj4ArmfTlaQwD0YWphI9Sa5RiaE8gUvwC6xnFHEf7jD9kEhd54mMkFwsWm1Ad 0VvwfN4vv012S3IWh+YJBALptNx/Y8ovM5/IwKmyDG9E9/VFIf7iWTu5KSZlJZJYNONf4 Mb5lU1sLoKRiwqb25gOmvqGTVX4xsUXTiD+CL4sjeKLSgwUlh6Tz1S8rEj83ao77htm00 Jh1HByP2toheRrh5QJlo9/8lqZAc9dTpG9yUk0TbaBVNSq/FpRqyZ4JmS7Zda3JeuoA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794670693; h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted: X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To: From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; bh=lZLJy6bzNUWfLiwfp/OHIdREPsKJ7Su3AkHPHH7wh/8=; b=YbUx/7HXR0ZPmhtg92AXO6Qixlm0Ya+nuFvRBlf2VCcCXv1sYdjLsO3zLvBTMySpNxDt uG0BW3jgg/U0aQ3fMApm3kDSv6Kg9pYPWcGseHHTnEYo/Xq9VY3ioDewTDpsphy5CYtWc mYU5EKCJ06ptvmCKn139b/0lAoFSnIkQnjy1zx8/VwgJMjCUdKkTuSkK9+lre4m7kdBO3 sE4t0tggNXCmQfN6raD6SVsGlQ7CUe16ikbXg5ZGv/vS9cm8ktwcyDRPJ3ZrPHdRas8/e YqHqxNWCgtrcXaxYzixB9T8hblUH1jeAuNg4m3W1RO6j47DQtn5ZBuASoWexFtehfNw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J14Na+tt; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA5BE606A327 for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 15:38:12 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 837601F000C6 for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 15:38:12 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794670692; bh=lZLJy6bzNUWfLiwfp/OHIdREPsKJ7Su3AkHPHH7wh/8=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=J14Na+ttPobaKmHX9bYSE41A7sQBsSPeDsYJoirRsm27ASs3BRvMfQd+Ofyr3nBGo B4UZRiG9JLDlO1N5QrNqPdDUKsO4S4QEoZz+vDCRQbiuEXVkb95XYtaPCYgn2BJ9VU QfKZjQEQ9OYgFVFScUCpGfSca9wUPm55nwUwYOzvPH8i9GnpMJUcZKVT2NGTil4OV5 vHoUukHrOpanAOlF23AJ0jxQjUT2ieK1J9DpD9MNsnxNtG0onXqTpRuWnbVt41uwBR A2ISSk5ww8bCsa6qryqkVzTn7m8RxnUKbMVu1xo7/PU6DNQv9lJ3QiDMSGMJILen1D Viqt8ENpabIKA== X-Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-71ad2c6491fso278484eaf.0 for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 07:38:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AL+hErEXfsr7q3PGUI8O5KgCqDul/O/WAV3dKzD6MgM+uys68hLleEa3kdY/xxeJiBO0aIb4ctjUnr8=@vger.kernel.org X-Gm-Message-State: APuU4Z95mgkm2Izw7Feq7I7raZaWho8O5INieSkpC2yvc6BlO2Vt1xsS 9xFO3L8VymSUKJviiEZDi/dz9bo45LP3HsXm2o0bCqmbVvVbAvmfGtYo1xX8UcWwIPw24lbMPtI b+FDhfAx984Y2U/nAYK5RKmNGJ7GK5h4= X-Received: by 2002:a05:6820:60c:b0:70e:177b:eafd with SMTP id 006d021491bc7-71ab5086aa7mr2905723eaf.16.1794670691913; Sat, 14 Nov 2026 07:38:11 -0800 (PST) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261114040101.1043546-8-kuniyu@google.com> X-Gmail-Original-Message-ID: <CAL4WiiqY-8011r9W_mGk1ZRZhmO2ac58s0ZiHEtKDyMzYrd1zg@mail.gmail.com> X-Gm-Features: AclHuK_0vQH_kcXOb_-kASCC9WUkmMpDMZVq3vl7tNG4sb5I7vb4f70hvWqu3eQ X-Cc: Neal Cardwell <ncardwell@google.com>, "David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Kuniyuki Iwashima <kuni1840@gmail.com>, netdev@vger.kernel.org