From: netdev-bot+sashiko@kernel.org
To: llleigoing@outlook.com
Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev,
edumazet@kernel.org, ncardwell@google.com, kuniyu@google.com,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, matttbe@kernel.org, martineau@kernel.org,
geliang@kernel.org
Subject: Re: [PATCH net 2/3] net: bound receive window predictions before narrowing
Date: Fri, 20 Nov 2026 08:22:53 +0000 [thread overview]
Message-ID: <179516297347.3136.13553293180683672285@kernel.org> (raw)
In-Reply-To: <20261117052200.1507847-3-llleigoing@outlook.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In tcp_rcvbuf_grow() (net/ipv4/tcp_input.c), the slow-start
growth term multiplies by `(newval - oldval)`.
- [Low] The From:/Signed-off-by: names do not match.
--
net: bound receive window predictions before narrowing
This patch changes rcvwin in tcp_rcvbuf_grow() and mptcp_rcvbuf_grow()
from u32 to u64, so the predicted receive window no longer wraps before it
is converted to a memory budget. The prediction is then clamped at INT_MAX
before it is passed to tcp_space_from_win() or mptcp_space_from_win().
> Fixes: aa251c84636c ("tcp: fix too slow tcp_rcvbuf_grow() action")
> Signed-off-by: lllei <llleigoing@outlook.com>
[Severity: Low]
The Author line is "lei lei <llleigoing@outlook.com>", but the sign-off
is "lllei <llleigoing@outlook.com>". The email addresses match and the
names don't. Could the names be made consistent? checkpatch will flag
the mismatch. The other patches in the series have the same mismatch.
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index a2074a1af4222..6d5950dbe6638 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
[ ... ]
> @@ -961,10 +961,10 @@ void tcp_rcvbuf_grow(struct sock *sk, u32 newval)
> * It might take few additional ms to reach 'line rate',
> * but will avoid sk_rcvbuf inflation and poor cache use.
> */
> - grow = div_u64((u64)rcvwin * rtt_us, rtt_threshold);
> + grow = div_u64(rcvwin * rtt_us, rtt_threshold);
> } else {
> /* slow start: allow the sender to double its rate. */
> - grow = div_u64(((u64)rcvwin << 1) * (newval - oldval), oldval);
> + grow = div_u64((rcvwin << 1) * (newval - oldval), oldval);
> }
> rcvwin += grow;
>
> @@ -973,6 +973,7 @@ void tcp_rcvbuf_grow(struct sock *sk, u32 newval)
>
> cap = READ_ONCE(net->ipv4.sysctl_tcp_rmem[2]);
>
> + rcvwin = min_t(u64, rcvwin, INT_MAX);
> rcvbuf = min_t(u32, tcp_space_from_win(sk, rcvwin), cap);
> if (rcvbuf > sk->sk_rcvbuf) {
> WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
[Severity: Medium]
Can this clamp turn an underflowed prediction into a fully saturated
subflow receive buffer?
The slow-start branch above computes (newval - oldval) in u32, and
tcp_rcvbuf_grow() never checks that newval > oldval. For MPTCP subflows,
mptcp_rcv_space_adjust() only compares copied against the msk-level space.
It then calls tcp_rcvbuf_grow() on every subflow:
net/mptcp/protocol.c:mptcp_rcv_space_adjust() {
...
if (copied <= msk->rcvq_space.space)
goto new_measure;
...
if (mptcp_rcvbuf_grow(sk, copied)) {
...
mptcp_for_each_subflow(msk, subflow) {
...
if (tcp_sk(ssk)->rcvq_space.space)
tcp_rcvbuf_grow(ssk, copied);
...
}
The msk space comes from a single subflow. mptcp_rcv_space_init() sets it
to min(rcv_wnd, TCP_INIT_CWND * advmss) of msk->first or the accepted ssk.
A join subflow sets its own space in tcp_init_buffer_space(), from its own
advmss and window.
For example, a first subflow with advmss 1460 gives an msk space of 14600.
A join subflow on a 9000 MTU path starts at around 62720. Both values only
grow after that, so the gap stays.
Suppose copied lands between those two values, e.g. copied=30000. That
already gives an msk prediction of about 186 KB, above the default
128 KiB sk_rcvbuf, so mptcp_rcvbuf_grow() returns true. For the join
subflow, newval - oldval then wraps to about 2^32. If that subflow's
rtt_us >> 3 is at least tcp_rcvbuf_low_rtt, the slow-start grow term is
around 1e10.
Before this patch, the u32 truncation gave an arbitrary result. With
newval == oldval / 2 the sum was exactly 2^33, so nothing changed.
Now that rcvwin is u64 and clamped at INT_MAX, every such underflow sets
sk_rcvbuf to tcp_rmem[2] on that subflow. window_clamp then becomes
tcp_win_from_space(sk, tcp_rmem[2]).
The commit message says:
Predictions above INT_MAX therefore already require a saturated
receive budget.
That assumes the prediction is meaningful, which isn't true when
newval < oldval.
The subtraction was already there before this patch. Would it make sense
to skip the slow-start growth when newval <= oldval?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117052200.1507847-1-llleigoing%40outlook.com
next prev parent reply other threads:[~2026-11-20 8:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 5:22 [PATCH net 0/3] tcp, mptcp: fix receive buffer sizing and peek accounting lei lei
2026-11-17 5:22 ` [PATCH net 1/3] tcp: saturate window-to-memory conversions at INT_MAX lei lei
2026-11-18 5:22 ` sashiko-bot
2026-11-19 7:54 ` Eric Dumazet
2026-11-20 8:22 ` netdev-bot+sashiko
2026-11-17 5:22 ` [PATCH net 2/3] net: bound receive window predictions before narrowing lei lei
2026-11-18 5:22 ` sashiko-bot
2026-11-19 7:56 ` Eric Dumazet
2026-11-20 8:22 ` netdev-bot+sashiko [this message]
2026-11-17 5:22 ` [PATCH net 3/3] mptcp: exclude MSG_PEEK from receive buffer autotuning lei lei
2026-11-18 5:22 ` sashiko-bot
2026-11-19 7:59 ` Eric Dumazet
2026-11-19 18:33 ` Matthieu Baerts
2026-11-20 8:05 ` Lin Lei
2026-11-20 8:22 ` netdev-bot+sashiko
2026-11-17 7:04 ` [PATCH net 0/3] tcp, mptcp: fix receive buffer sizing and peek accounting MPTCP CI
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=179516297347.3136.13553293180683672285@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=llleigoing@outlook.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.