Article View: linux.kernel.netdev
Article #26591Re: [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 21:51
Date: Thu, 03 Dec 2026 21:51
83 lines
11011 bytes
11011 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] After this patch, mptcp_try_coalesce() in net/mptcp/protocol.c
has two comments next to each other that disagree about the 'from'โฆ
--
mptcp: reclaim forward memory after coalescing skbs
When an MPTCP socket takes an skb from a subflow, mptcp_borrow_fwdmem()
credits skb->truesize to the msk forward allocation. Only part of that
credit moves to sk_rmem_alloc when the skb is coalesced or condensed, so
the rest builds up in sk_forward_alloc. This patch adds sk_mem_reclaim()
calls in mptcp_try_coalesce() and mptcp_data_queue_ofo() to release that
leftover memory.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e89ed0b1e4218..8649e739ae500 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -196,6 +196,9 @@ static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to,
> sk_mem_charge(sk, delta);
> kfree_skb_partial(from, fragstolen);
>
> + /* release what is left of the borrowed 'from' truesize */
> + sk_mem_reclaim(sk);
> +
[Severity: Low]
This isn't a bug, but after this change the two comments in
mptcp_try_coalesce() disagree about the 'from' skb. Each one is wrong for
one kind of caller.
The existing comment just above says:
/* note the fwd memory can reach a negative value after accounting
* for the delta, but the later skb free will restore a non
* negative one
*/
For the borrowed callers, __mptcp_move_skb() and mptcp_data_queue_ofo()
via mptcp_ooo_try_coalesce(), mptcp_subflow_lend_fwdmem() has cleared
from->destructor. mptcp_borrow_fwdmem() has also already added
from->truesize to sk_forward_alloc.
Since delta can't exceed from->truesize, sk_mem_charge(sk, delta) can't
push the forward allocation negative. kfree_skb_partial() also runs no
destructor, so the later free restores nothing. That is the reason this
patch needs the explicit sk_mem_reclaim().
The new comment assumes 'from' is always borrowed. That doesn't hold for
__mptcp_ofo_queue():
if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) {
On that path 'from' is an out-of-order queue skb. skb_set_owner_r() already
gave it sock_rfree at the end: label of mptcp_data_queue_ofo(), so
kfree_skb_partial() ends up calling sock_rfree()->sk_mem_uncharge(). That
already returns from->truesize and reclaims. There the old comment is the
accurate one, and the new reclaim is redundant but harmless.
mptcp_drop() states this borrowed vs owned split explicitly:
if (!skb->destructor)
sk_mem_reclaim(sk);
Could the comments in mptcp_try_coalesce() be updated to cover both cases?
For example, drop the stale "later skb free will restore" text and say the
reclaim is needed for borrowed skbs that have no destructor.
> return true;
> }
>
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17%40kernel.org
Technical Details
Message-ID:
<179633471597.3146.16650809270259188045@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376888-linux-kernel-netdev=dewy.ruReferences:
<20261202-net-mptcp-misc-fixes-7-4-rc7-v1-7-9f03efcb1a17@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376888-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs Date: Thu, 03 Dec 2026 21:51:55 +0000 Organization: Usenet Network Message-ID: <179633471597.3146.16650809270259188045@kernel.org> References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-7-9f03efcb1a17@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2606259"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LyUqZou9xuv6DdLviTMX71PTsv0= sha256:XEh4ZkvBkT8sMBr7eR7E/hSk6qw2zkNtjeh3DPyM9TU= sha1:v7Xwv8GHhcVySy50+63EDjE3Nws= sha256:uB1uA3O1BW3N1Ldrlg8SEeFIHD22MURwCCwTNwqqW6A= 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 614A4117A08; Fri, 4 Dec 2026 00:52:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, 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 XUPl3QOKwMMU; Fri, 4 Dec 2026 00:52:18 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376888-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 5F004117A3B; Fri, 4 Dec 2026 00:52:08 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 04FE025DF2; Thu, 3 Dec 2026 21:52:04 +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=1796334718; b=LISatP7Pm33GLBCMre6nKwRPidSZlC/5NABUUaWIkdbQs5VvW803/AiFqiG6zlDXqhP9 XeETbgb0W5gY0z6PXObSMo3wDQ8K0Tnag2rrtg3LJsPmZi0SeY2/5mk400mLDdkoJFUkm vdaFQKdMiWj0kqqUmk8jVJQIPNaoEANykTwq0asSwPVpgl4H/NAEJu3pHGV8jMsqMIIML UWsUm0Mcy9Ia04X/Fpmx7+Qi1uXKSxoJFJtRKEZ8L0z4ueGAbp0HveVFmVoYdGbDhz0Ev 1OjktEPW2lZIAWybMmSb7OR9aL2Q5pzfMX0mqJFKitUfINxSe/5CNyMcKOAXUAXNZUA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334718; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=emWUqLKxWAqrUoAwCctTmJmedWRlM+xHsCr0ozIeTvg=; b=TAWy3bCCv9gcnoN4NXjenTqZocmLcp9PFiFjgbhR2WVE5/Xjg/AUItoYplpvdo2HjJdu HbnvM7oEv3wvTDbi2MkyD/UZoPPKI3+UDaxa+jTNjtMM19k3ggxhICrQuGM1ZWi9KNgCn gAmjnWEkPWGXa0nRkzJgL3rxkR7CpEE0P8u3YqNUhaYr4uqhHGr7k5te7AOKSG2Jwaphn e6rS66aPo4HQ6VzHuluaEtaboYF25KR/HTer2HbU6OkhadfBfYJWY0bwnBJP0ZyRIO0RU QjqtyL8hhafRlmS8+nuKWOfSb+iwqcZhrmNQ+1pIflOGYCTy+ii4wLpgTxX0TbzgyUA== 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=KE32cS4F; 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 617A7606A338; Thu, 3 Dec 2026 21:51:58 +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=KE32cS4F 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=1796334717; b=3YOPYF3wQJgsT9r08K87QLZRNs2iWR25VjIibru8IeXyqMNoFUaBa3VBCRT9Hz+CljK9 +kShbX7k5tHoin3OSbYfkc+ZSweujoN4B5gNZS0efsIzOzZ/OX1FRomikRF3w/dTe0zJH 9RXl1CHUeIDOMvyFpV39WteDNn1jyCVG98BfG8wfQf70Y1S+Cbp0dZ2vtqTwgK6EC5JpG fprsbJ6VHhhPV0N1E/pUnoN/eLinwDPFdiQEAepQoI1BmT2vF0xnHDbxeLayzRWy6cKz8 Gh7knaiWn4BszoGE6Pti6xC07T3XUnWGFlUDPImi2YVHK2jbUQYYll9JaEziCi6Ltyw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334717; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=emWUqLKxWAqrUoAwCctTmJmedWRlM+xHsCr0ozIeTvg=; b=BMCPRR+T5LxaKABLcxw8WM4r6jMSLPOtSHX0sA3NwJZo+Gb5oyBZvDs7YQzbN8cXJDI5 3DP2wTUUUXeRH7HZfdEbZE4C1n6OGGfi57TtUGCXArsE3GE+fP+Fdsh+Yrr2nLpfHw1hY GLnA2wmAkX3sxugZ7xud5hq2vkuvOd5Er5cRNDvGlRJ24ZUbLd4CSFvibt5PS6FX+kesC 7NQGcUkH4+bryA90wEijy98oxN0LneddtCpbaX0ZIn48hfQyXjsaTYqks0wjliPuVvYwo 0kxuB5u7G4fM4GPt958ezaeZuHhkLBJzPhGi8vTInqx5HVc9ILp3ZxJ92m5XyPVQabQ== 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=KE32cS4F; 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 62A02606A322; Thu, 3 Dec 2026 21:51:57 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A811F000CE; Thu, 3 Dec 2026 21:51:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796334717; bh=emWUqLKxWAqrUoAwCctTmJmedWRlM+xHsCr0ozIeTvg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=KE32cS4FMwArPq56j/xuM/eYjdbEVEKesCepWUorcI+VOY0H8sZeImhRoM9MEW4Zk bFdUioVjODoMsVl8lsva0ZP00bLw6cVf7qdioZYcAc2qJbzI/+aZ+RlqRIQJRF0/VK DemAf5GkYaMncUzZHhpMtexz0FU2GyGxOVwBzOWY2F4BbYi7N8TligoemhI7CPabTR IlrUOIAevonmyU0R9i0son0D7d5knQ+8i69a6OuREQODY7z403/m5hGZCYaNKnvs6t gwD54t14sKoirUNTVEvjuWgDkOu9FFjqXl6I88NaCbqtQnaIGbShCWLUrANSmQ5Jae V2rgTnUJeTS2w== X-Cc: martineau@kernel.org, geliang@kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, dcaratti@redhat.com, netdev@vger.kernel.org, mptcp@lists.linux.dev, mason@kernel.org, stable@vger.kernel.org X-In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-7-9f03efcb1a17@kernel.org> X-sashiko-severity: Low 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