Netdev List
 help / color / mirror / Atom feed
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 1/3] tcp: saturate window-to-memory conversions at INT_MAX
Date: Fri, 20 Nov 2026 08:22:52 +0000	[thread overview]
Message-ID: <179516297210.3136.8495911905614638988@kernel.org> (raw)
In-Reply-To: <20261117052200.1507847-2-llleigoing@outlook.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 author and DCO sign-off names do not match.
- [Low] (Baseline decision: not a valid regression; kept only because
  requires_validation=true.) The concern: when scaling_ratio < 128 and…

--

tcp: saturate window-to-memory conversions at INT_MAX

This commit caps the u64 result of __tcp_space_from_win() at INT_MAX
before it is returned as an int. Without the cap, large results can wrap
when narrowed. That lets the TCP and MPTCP SO_RCVLOWAT handlers accept a
large low watermark without raising sk_rcvbuf.

> Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
> Signed-off-by: lllei <llleigoing@outlook.com>

[Severity: Low]
This isn't a bug, but the Signed-off-by name does not match the From
name. The author is "lei lei <llleigoing@outlook.com>" and the sign-off
is "lllei <llleigoing@outlook.com>". The email is the same but the names
differ, and checkpatch.pl reports this as FROM_SIGN_OFF_MISMATCH.

The other two patches in the series have the same mismatch:

  net: bound receive window predictions before narrowing
  mptcp: exclude MSG_PEEK from receive buffer autotuning

Could the series be resent with one consistent identity?

> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 5c9203aae8341..09827f1ae0a72 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -1799,7 +1799,7 @@ static inline int __tcp_space_from_win(u8 scaling_ratio, int win)
>  	u64 val = (u64)win << TCP_RMEM_TO_WIN_SCALE;
>  
>  	do_div(val, scaling_ratio);
> -	return val;
> +	return min_t(u64, val, INT_MAX);
>  }

[Severity: Low]
This probably isn't a regression, but one side effect of the saturation
is worth checking.

When scaling_ratio is below 128 and val is around tcp_rmem[2] >> 1, the
result saturates to INT_MAX. Then __tcp_win_from_space(ratio, INT_MAX)
is smaller than val, so sk_rcvbuf no longer covers sk_rcvlowat.

__tcp_set_rcvlowat() in net/ipv4/tcp.c still stores the full watermark
and raises window_clamp to val:

	WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
	...
	space = tcp_space_from_win(sk, val);
	if (space > sk->sk_rcvbuf) {
		WRITE_ONCE(sk->sk_rcvbuf, space);

		if (tp->window_clamp && tp->window_clamp < val)
			WRITE_ONCE(tp->window_clamp, val);
	}

mptcp_set_rcvlowat() in net/mptcp/sockopt.c does the same for the msk
and each subflow.

This seems harmless:

  - __tcp_select_window() takes min_t(int, tp->window_clamp,
    allowed_space), so the larger clamp is never advertised.

  - For TCP, tcp_epollin_ready() falls back to tcp_rmem_pressure(), so a
    watermark the buffer cannot reach does not stall the reader.

  - The SOCK_RCVBUF_LOCK branch already accepts a watermark that the
    buffer cannot back.

  - Before this patch the budget was not raised at all.

mptcp_epollin_ready() has no rmem-pressure fallback. That limitation
predates this patch and can also be reached through the SOCK_RCVBUF_LOCK
path.

Should the commit message say that sk_rcvbuf can still be too small for
the requested SO_RCVLOWAT once it saturates?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117052200.1507847-1-llleigoing%40outlook.com

  parent reply	other threads:[~2026-11-20  8:22 UTC|newest]

Thread overview: 12+ 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-19  7:54   ` Eric Dumazet
2026-11-20  8:22   ` netdev-bot+sashiko [this message]
2026-11-17  5:22 ` [PATCH net 2/3] net: bound receive window predictions before narrowing lei lei
2026-11-19  7:56   ` Eric Dumazet
2026-11-20  8:22   ` netdev-bot+sashiko
2026-11-17  5:22 ` [PATCH net 3/3] mptcp: exclude MSG_PEEK from receive buffer autotuning lei lei
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

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=179516297210.3136.8495911905614638988@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox