Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kuniyu@google.com
Cc: edumazet@kernel.org, ncardwell@google.com, davem@davemloft.net,
	kuba@kernel.org, pabeni@redhat.com, matttbe@kernel.org,
	martineau@kernel.org, horms@kernel.org, kuni1840@gmail.com,
	netdev@vger.kernel.org, mptcp@lists.linux.dev
Subject: Re: [PATCH v2 net-next 2/7] tcp: Don't collapse high density skb.
Date: Tue, 17 Nov 2026 23:13:38 +0000	[thread overview]
Message-ID: <179495721836.3136.13013697525497561871@kernel.org> (raw)
In-Reply-To: <20261116230555.2305867-3-kuniyu@google.com>

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] The commit message describes a real regression, but the patch has
  no Fixes: tag.

--

tcp: Don't collapse high density skb.

This patch caps the scaling_ratio that tcp_collapse() uses at the highest
ratio a collapsed skb can reach (222 with 4K pages). It also changes the
bloat check so it only looks at the bytes left unread after start. With
this, tcp_collapse() no longer collapses an skb it just produced, and it
no longer collapses a dense GRO skb just because a few bytes of it were
read.

> If 4K-MSS GRO skb updates tp->scaling_ratio, it can be larger
> than 222.
>
> Then, even the newly collapsed skb could be detected as bloated
> by the next tcp_collapse().

[Severity: Low]

This describes a regression in tcp_collapse(). Should the patch carry a
Fixes: tag?

The re-collapse seems to have become possible with commit dfa2f0483360
("tcp: get rid of sysctl_tcp_adv_win_scale"). That commit made
tcp_win_from_space() use the per-socket scaling_ratio. For dense skbs,
tcp_measure_rcv_mss() can raise that ratio as high as 255:

net/ipv4/tcp_input.c:tcp_measure_rcv_mss() {
    ...
			u64 val = (u64)skb->len << TCP_RMEM_TO_WIN_SCALE;
    ...
			do_div(val, skb->truesize);
			tcp_sk(sk)->scaling_ratio = val ? val : 1;
    ...
}

Take a full collapsed skb (len 3776, truesize 4352) and a ratio of 230.
The old check in tcp_collapse() gives 4352 * 230 >> 8 = 3910, which is
greater than 3776. So the skb counts as bloated and is copied again on
every prune.

Before dfa2f0483360, the default adv_win_scale=1 reduced the check to
truesize / 2 > len. That gives 2176 > 3776, which is false, so collapsed
skbs never matched.

Documentation/process/maintainer-netdev.rst says the Fixes: tag is
required for fixes, regardless of the tree. Would adding the following
help with tracking?

  Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")

If the patch is meant only as a heuristic improvement for net-next, could
the commit message say that?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116230555.2305867-1-kuniyu%40google.com

  reply	other threads:[~2026-11-17 23:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 23:05 [PATCH v2 net-next 0/7] tcp: Prevent tcp_collapse() from bloating queue Kuniyuki Iwashima
2026-11-16 23:05 ` [PATCH v2 net-next 1/7] tcp: Refactor the first loop in tcp_collapse() Kuniyuki Iwashima
2026-11-16 23:05 ` [PATCH v2 net-next 2/7] tcp: Don't collapse high density skb Kuniyuki Iwashima
2026-11-17 23:13   ` netdev-bot+sashiko [this message]
2026-11-16 23:05 ` [PATCH v2 net-next 3/7] tcp: Stop collapsing if not bloated Kuniyuki Iwashima
2026-11-17 23:13   ` netdev-bot+sashiko
2026-11-16 23:05 ` [PATCH v2 net-next 4/7] tcp: Skip collapsing if collapsed skb is less-dense Kuniyuki Iwashima
2026-11-17 23:13   ` netdev-bot+sashiko
2026-11-16 23:05 ` [PATCH v2 net-next 5/7] tcp: Allocate all new skb before collapsing Kuniyuki Iwashima
2026-11-17 23:13   ` netdev-bot+sashiko
2026-11-16 23:05 ` [PATCH v2 net-next 6/7] tcp: Batch memory accounting in tcp_collapse() Kuniyuki Iwashima
2026-11-16 23:05 ` [PATCH v2 net-next 7/7] selftest: packetdrill: Add test for tcp_collapse() Kuniyuki Iwashima
2026-11-17 23:13   ` netdev-bot+sashiko

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=179495721836.3136.13013697525497561871@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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