๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19035

Re: [PATCH net 2/3] net: bound receive window predictions before narrowing

#19035
From: Eric Dumazet
Date: Thu, 19 Nov 2026 07:56
72 lines
12043 bytes
Le mar. 17 nov. 2026 ร  06:22, lei lei <llleigoing@outlook.com> a รฉcrit :
>
> tcp_rcvbuf_grow() and mptcp_rcvbuf_grow() compute growth terms in u64 but
> accumulate the predicted receive window in u32. The prediction can wrap
> before conversion to a memory budget and application of tcp_rmem[2].
>
> For example, oldval=16 KiB and newval=4104 KiB produce a slow-start
> window prediction of 4 GiB + 8 MiB. Storing it in u32 leaves only 8 MiB,
> so the memory limit is applied to an already truncated prediction.


The arithmetic is right, but I do not see a bug worth a net patch
and stable backports.

This needs @newval to be ~256 times @oldval between two consecutive
measurements. The "allow the sender to double its rate" logic was
never meant to be meaningful for such a sample: a 4GB prediction
out of 4MB copied to user space is garbage, wrapped or not.

What happens today: this round gets a smaller sk_rcvbuf increase than
the formula asked for (or none). sk_rcvbuf never shrinks here, and
the next measurement has a sane @oldval. So we lose one step.

What happens with your patch: a single sample like this sends
sk_rcvbuf straight to tcp_rmem[2].

This is the kind of sk_rcvbuf inflation we have been trying to avoid
lately, see commit aa251c84636c and the tcp_rcvbuf_low_rtt logic.
I am not convinced this is an improvement.

>
> Keep rcvwin in u64 and promote newval before the initial shift. Clamp
> the completed prediction at INT_MAX before passing it to the existing
> int-input window-to-memory helpers. Since scaling_ratio is a nonzero
> u8, the required memory is at least as large as the window. Predictions
> above INT_MAX therefore already require a saturated receive budget.
> The helpers' return saturation and the existing tcp_rmem[2] limit then
> provide the appropriate memory bound.
>
> TCP and MPTCP loopback tests using small warm-up reads followed by a
> queued burst of about 4 MiB previously left the budget below the
> configured 64 MiB limit. With this change, both reach that limit.

For TCP, the slow start branch is only taken if the RTT is above
tcp_rcvbuf_low_rtt (1ms by default). I guess you had to change this
sysctl to get this result over loopback ? Please describe the full
setup, including tcp_rmem[1].

More importantly, reaching tcp_rmem[2] after a single 4MB burst is
not a goal. What is the user visible problem here ? Do you have
numbers (throughput, drops, rcv window) for a real flow ?

If there is a real case where growth is too slow, I would rather
discuss the heuristic than the type of @rcvwin.

If you send this again:

- net-next, no Fixes: tag, unless you can show a real regression.

- Please split TCP and MPTCP changes. One patch with a "net:" prefix
  touching both, with a single Fixes: tag pointing to a TCP commit
  is not right for mptcp_rcvbuf_grow().

>
> Fixes: aa251c84636c ("tcp: fix too slow tcp_rcvbuf_grow() action")
> Signed-off-by: lllei <llleigoing@outlook.com>

Same remark about the Signed-off-by: than for patch 1.

Thanks.
Technical Details
Message-ID: <CAL4WiiqM1E9wzfjCzHcOy2SN6j0CjN6r94JYdPNt=RoLLDL5hw@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366832-linux-kernel-netdev=dewy.ru
References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366832-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/3] net: bound receive window predictions before narrowing
Date: Thu, 19 Nov 2026 08:56:32 +0100
Organization: Usenet Network
Message-ID: <CAL4WiiqM1E9wzfjCzHcOy2SN6j0CjN6r94JYdPNt=RoLLDL5hw@mail.gmail.com>
References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2822239"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NX8fwEoAj73aASfc0BxrCOeSMbY= sha256:ZO/88a8lKOb2mwlJg77shkhxCB35j3UUOLRK3r8xzI4=
	sha1:lwDd4bApjfiNx7ySAcCWHr9qIhY= sha256:jMIpdlJjQpz6NO91l3BHaCW4RoeNCSv0TojoQCTel1o=
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 1547F115556; Thu, 19 Nov 2026 10:57:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 lYbKMtMCneqV;
	Thu, 19 Nov 2026 10:57:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-366832-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 3360A115514; Thu, 19 Nov 2026 10:56:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 7C7DB1E5406; Thu, 19 Nov 2026 07:56:46 +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=1795075005;
	b=SdtqCKjxea/Qqe91AqaNbOxBzo/lce1/9NqvFznWT37ExWH/lo5YAzdGKFhCYsLN1nG4
	 4acBgFVHQCUZ4HXtWbwr9d8k6YtL7TkE9PPXa62eb6TXTDdo49/Z0IzyD4tezeqD9BR0k
	 k/mkExI53QX9NSni0RBzrnYKwI9tFn0Sga2kDJweTObRWMHdedAMKEwA+uaXa/eH7TSHV
	 ePrmkkp3cLQgCRFfp7iBveWlqOv6IYiT42FlmVymac/d/mj34M0I6zWokGId3dtfQnjU7
	 jRD5mrRkTKTNALLwWsNe5UZ92GENPeSIbb0oQVjYUzCezRkLXKwafecIhH29FwVtNTw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795075005;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Gm-Message-State:X-Received:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=TkTQbJb7ZBAG3dKvrkB8K4SdQF87n1mSeZ/di/8jo5I=;
	b=5ANZ9elx+6pBZaNBdvs7C6TubwHDuStbOiWF+FG/X489eyOl4E1wOLAKbmBYDE4Fjeej
	 /gtRI24Vj7AYuxm2xJArNivBVe5PACI99odUYPOEtjPc4JqWneiOCg1V/SiDi6byKm6qt
	 8diVPC/NliAtT4xGi+Vd5aGc6XsdRad91ZdOQX2ojv2HWaf6SSIWz+4q2h1Q5Q+4Y0OtW
	 HOtqj8ktHuPWC4jqYpDsbiQwNWjDtZUWf7nUW3XJv1HqEk+V/xwSX+VAVotEj23tYHnDy
	 CnC0xpOxX1bNYHpFDWnLUnDf9b/8fakft9GBWMAAN1a0fpJfkhkpXiVy2Gcvq9gjnaQ==
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="oFn/TIXo";
	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 D4B3F606A330;
	Thu, 19 Nov 2026 07:56:45 +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=oFn/TIXo
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=1795075005;
	b=R3UfHGnF6qpmX4q/XE3D5GVxk+cvUMQgfLiEM6v/8Z4JnsELOqwJBRkb3+sew9Pu+4Rj
	 ISIFiG7SjCiR2ZL0jaSAIcGHxcN93qcjoJ3xgUGwcRixbhU8+tjX9JVGDEXJX3x89MJFw
	 PBomblA8hPvZ0I3FjANFKqTJXqT+oPuLzfDMp1jFete33UN+Nf3nDm8WEVT/fNcNM7sg2
	 Apiv10SKpLVVjywDvkWNhvpJFRczTedWQ2ceZ4s8R0fFn3SCcoqTuOJweBM/8OQkoAN5j
	 GuKQvK+W5C/MR7QlXMJ/mwteLtFocH3PVy432AmH7tEJGnTqB9EHM4VaHz5XLksrr6A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795075005;
	h=Received:DKIM-Signature:Received:X-Gm-Message-State:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=TkTQbJb7ZBAG3dKvrkB8K4SdQF87n1mSeZ/di/8jo5I=;
	b=NMUqxBsHZ9YJnqH96DRpijuM/GY7aoHFAVCldGwIFdZuMBoPz7vkVXWNbB42voiBW1TE
	 umNPR3fJfKdjqxYUPLyqEg2NX6l/H8evH4nedB0Qe1uNkK+c97xiMV457lvN9OD53x9ic
	 iCQLHsLXSX0aN/RSQFUXh3NnZudEfzd+frKAr7h2Jmfo0GUf9HICc6HmjjW5fsOFTMy1r
	 DDrWeYVsFboLMQpQOggE3xxuhDeGthTLl++HOZ4UgkDQyVfUTNS42kTtmSK9dnmyC5XKh
	 5FAAc4BvqiTCBuJ81xRfZXVgKRtMZk3F7oVn/ebdujcjmuK+ewOYobEsd9Qa0RpXk6Q==
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="oFn/TIXo";
	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 F2911606A326
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 07:56:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 900E01F000C7
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 07:56:44 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795075004;
	bh=TkTQbJb7ZBAG3dKvrkB8K4SdQF87n1mSeZ/di/8jo5I=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=oFn/TIXoG+Jq/iqJIWnO9NtoN5zFhYH0al+g7BexIu30nk3OvT35FVlEQBVQiAyxt
	 MZ8hSNL1qWDm4rfP3/YDYnSKkWM9ORWTVc5oTX8L8pOPrXbROKyZ5jN8GxQprSORCL
	 eSlMupBux4XrX6PFThmx5gYOPkZsLt1pU58qgm8EPcSMA4t8l6COVgUOJtuhX7P5VB
	 NvQ+E96UeYF96b1YOv6FsLOorJq4qnbNNIIHZCTS+jo85ymxrL2fiYUZzfuOIyKScs
	 pKGJ/SYbTbNnXLpIMTr8J/N6WwhSxshzcgSOux+j557cJjeGytHdSuQrS47dT0r6dq
	 8MKrsMDuXJoSA==
X-Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-71ad047710aso1288689eaf.3
        for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 23:56:44 -0800 (PST)
X-Gm-Message-State: APuU4Z9gZ4H1fcP4l2tFVDG4po4JZnAro6IG0pqHK/MsDSp+SrYKDWhy
	NbpWp6Z3QtthtsyxPiF9yXaesJBN1mW2Z0EXFX4MZIIVNAdSLudQseYZ+voh4YIjtw0nLW2eSaX
	3dpqvtaH6fPcz9xTeUIINoHu1H7VAMB4=
X-Received: by 2002:a05:6820:718e:b0:709:1cc3:ddee with SMTP id
 006d021491bc7-71b18565791mr3232862eaf.30.1795075003834; Wed, 18 Nov 2026
 23:56:43 -0800 (PST)
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
X-In-Reply-To: <20261117052200.1507847-3-llleigoing@outlook.com>
X-Gmail-Original-Message-ID: <CAL4WiiqM1E9wzfjCzHcOy2SN6j0CjN6r94JYdPNt=RoLLDL5hw@mail.gmail.com>
X-Gm-Features: Aa3M54oHoxM2jrktDV6WswGASwLmtrm_DrDU4DbPoPZZCDg5xjCqEnOqEYYDEHY
X-Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "mptcp@lists.linux.dev" <mptcp@lists.linux.dev>, 
	"ncardwell@google.com" <ncardwell@google.com>, "kuniyu@google.com" <kuniyu@google.com>, 
	"davem@davemloft.net" <davem@davemloft.net>, "kuba@kernel.org" <kuba@kernel.org>, 
	"pabeni@redhat.com" <pabeni@redhat.com>, "horms@kernel.org" <horms@kernel.org>, 
	"matttbe@kernel.org" <matttbe@kernel.org>, "martineau@kernel.org" <martineau@kernel.org>, 
	"geliang@kernel.org" <geliang@kernel.org>