From: netdev-bot+sashiko@kernel.org
To: matttbe@kernel.org
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
Subject: Re: [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs
Date: Thu, 03 Dec 2026 21:51:55 +0000 [thread overview]
Message-ID: <179633471597.3146.16650809270259188045@kernel.org> (raw)
In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-7-9f03efcb1a17@kernel.org>
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
next prev parent reply other threads:[~2026-12-03 21:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 21:29 [PATCH net 0/9] mptcp: misc fixes for v7.4-rc7 Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 1/9] mptcp: pm: kernel: c-flag: keep local_addr_used in sync Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 2/9] mptcp: keep an orphan while it can send its data Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 3/9] mptcp: limit an orphan probing a zero window Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 4/9] mptcp: count orphans as TCP does Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 5/9] mptcp: return EOF after a DATA_FIN, " Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 6/9] mptcp: wake up blocked senders when no sf left Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs Matthieu Baerts (NGI0)
2026-12-03 21:51 ` netdev-bot+sashiko [this message]
2026-12-02 21:29 ` [PATCH net 8/9] mptcp: don't charge a shared page twice at accept() Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 9/9] mptcp: don't charge the backlog " Matthieu Baerts (NGI0)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179633471597.3146.16650809270259188045@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@kernel.org \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=martineau@kernel.org \
--cc=mason@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox