Article View: linux.kernel.netdev
Article #24083Re: [PATCH net 2/3] net: bound receive window predictions before narrowing
From: Matthieu Baerts
Date: Sun, 29 Nov 2026 07:50
Date: Sun, 29 Nov 2026 07:50
108 lines
12747 bytes
12747 bytes
Hi Lin Lei,
Thank you for looking at this issue.
29 Nov 2026 07:38:02 Lin Lei <llleigoing@gmail.com>:
> Hi Matthieu, Paolo, Eric,
>
> Following up on the MPTCP subflow issue Sashiko flagged on patch 2/3:
>
> On Fri, 20 Nov 2026 08:22:53 +0000, netdev-bot+sashiko@kernel.org wrote:
>> Can this clamp turn an underflowed prediction into a fully saturated
>> subflow receive buffer?
> [...]
>> Before this patch, the u32 truncation gave an arbitrary result. With
>> newval == oldval / 2 the sum was exactly 2^33, so nothing changed.
> [...]
>> The subtraction was already there before this patch. Would it make sense
>> to skip the slow-start growth when newval <= oldval?
>
> Yes, this heterogeneous-subflow case (e.g. an MTU 1500 initial subflow
> and an MTU 9000 MP_JOIN subflow, with @copied landing between their
> rcvq_space.space values) can indeed happen: (newval - oldval)
> underflows and produces a bogus slow-start prediction.
>
> Cases like newval == oldval / 2 leaving sk_rcvbuf unchanged before v1
> only happened by coincidence because 2^33 wrapped to 0 in u32 (in a
> local test of this MTU 1500 + 9000 setup on unpatched 7.4.0-rc2, a
> 30 KB read already sends the join subflow's sk_rcvbuf straight to
> tcp_rmem[2] and moves its rcvq_space.space backwards). Relying on
> 32-bit wraparound is not valid behavior; avoiding bogus growth here
> should be handled explicitly by the algorithm.
>
> If this seems worth addressing, I see two main options:
>
> 1) Option 1: Skip slow-start growth when newval <= oldval in
> tcp_rcvbuf_grow(), as Sashiko suggested.
>
> This avoids the underflow without affecting tcp_data_queue_ofo()
> (which passes newval == oldval), but pure TCP callers already
> guarantee newval >= oldval, and tp->rcvq_space.space = newval at the
> top of tcp_rcvbuf_grow() would still move the larger-MTU subflow's
> space estimate backwards.
>
> 2) Option 2: Keep tcp_rcvbuf_grow() unchanged and clamp the sample to
> at least the subflow's existing rcvq_space.space in MPTCP:
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2321,12 +2321,14 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
> mptcp_for_each_subflow(msk, subflow) {
> struct sock *ssk;
> bool slow;
> + int space;
>
> ssk = mptcp_subflow_tcp_sock(subflow);
> slow = lock_sock_fast(ssk);
> + space = tcp_sk(ssk)->rcvq_space.space;
> /* subflows can be added before tcp_init_transfer() */
> - if (tcp_sk(ssk)->rcvq_space.space)
> - tcp_rcvbuf_grow(ssk, copied);
> + if (space)
> + tcp_rcvbuf_grow(ssk, max(copied, space));
> unlock_sock_fast(ssk, slow);
> }
> }
>
> Personally, Option 2 seems cleaner to me: it fixes the issue at the
> only caller that can pass a smaller sample, preserves the subflow's
> existing space estimate, zeros the slow-start delta when
> copied < space, and still lets TCP account for its own OOO queue
> (per commit 6b329393502e) and low_rtt policy.
>
> What do you think? If this looks reasonable to you, I plan to submit a
> standalone patch.
I didn't check in details, but if this behaviour is specific to MPTCP, and
if it can be easily fixed on MPTCP side, then better to do so. So option
2.
(Note about your previous email: maintainers and reviewers are
currently overloaded, and I don't think they will be able to go through
long emails replies. It might be easier for them if you send patches or
new versions containing short and specific questions around them.)
Cheers,
Matt
Technical Details
Message-ID:
<a64fbd90-4cba-42b8-977c-ac98171c39e6@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373408-linux-kernel-netdev=dewy.ruReferences:
<20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com> <179516297347.3136.13553293180683672285@kernel.org> <20261129063755.1972521-1-llleigoing@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373408-linux-kernel-netdev=dewy.ru From: matttbe@kernel.org (Matthieu Baerts) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/3] net: bound receive window predictions before narrowing Date: Sun, 29 Nov 2026 08:50:46 +0100 Organization: Usenet Network Message-ID: <a64fbd90-4cba-42b8-977c-ac98171c39e6@kernel.org> References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com> <179516297347.3136.13553293180683672285@kernel.org> <20261129063755.1972521-1-llleigoing@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1128475"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OblLke20bGMKypA69VgXeSvRIJw= sha256:xMoBXnULPF6fi1AfWxaLphIakK8u3QyklDupjjdLU20= sha1:qp1M+ygyAl1MVWPcvsl6QwJdQus= sha256:nNCQCQZX8E5KI68PABHFMSrohCbv/1LebYyJBDHgZ9A= 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 F13AB125F95; Sun, 29 Nov 2026 10:51:12 +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 MAChzkCW3Wfc; Sun, 29 Nov 2026 10:51:08 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373408-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5EB94125F93; Sun, 29 Nov 2026 10:50:58 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 202A22508C; Sun, 29 Nov 2026 07:50:54 +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=1795938653; b=3XHFF2VYAUSNPtahO4jmNsRIgrX3VAGn+JitMaoxnXIUkFuJcIG9HuOvDhvNZ+p4h6k7 Dr/9wu+ajqPl1wXMhFWwbJPc19kX5ljjzQiUoX/U188ZrE3b8+EE4wBlmGswNpOShDjVs aII8rhE9DCyEntvHsRgq9esCC+nPxTy13HNJbBJwEViEXFZqDdKJbp4wiN+G5dkGMIOl2 atGopFBlHizvkkkbE/KC9V7NbdO2tVKbCZpHHOFgwY04mUM65Ksleu4YRCwjbMIRNpPzi sBtOxbIp4BlZHmMH+ppY5QQGPW0CGYDg+j6JjWu3FGPYm7hjjFulCW3UI3RtMrsYbvg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795938653; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Message-ID:In-Reply-To:References:Subject:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding: X-Correlation-ID; bh=KGUpwze/ip2o93j5A7yKwcD1NYfQl1KRELjozblwuXA=; b=fMRtsVFAbndCV4pFKN5objUBAo/tfN5btmEFx2/7i9IR9u5bAvIDycpaGZkZidvcgK3y YtAe/jLdAlLgsu3BfU1BMmn7nnBXGU7ucm9hNmk67m7BOpfw12mB/eywhtAu46mA9F+vz 4FujR2OzJwKwZ/itU3auDAjo/FzwUAU44EQYnyMMHa9ABLL3XEyo7vazy5NWoeFd3OEd8 xbAU7z3gfoSvAzCjHrwdbKnYfJLHZZ6kjrPKLrqkGLX8pqOu5yHvCKswqtMqfvHrikbZC kwYLSleHoUAUtdflBFIUtTnM3YIG/5kUeypR2iTlxpOSD7cpMC5AI51gb7XU+SgQKSg== 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=QdWIPpEx; 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 96B79606A32C; Sun, 29 Nov 2026 07:50:53 +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=QdWIPpEx 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=1795938652; b=02T9geHmGNHj9Wpj5/e/7yRUL/1As//bd5k+vZOvd1gGyIFBjbvm3Sk+CM/yP3T70RT/ +dtWGEDm86FgK2LmsIbhlksg7sjtpEZMeddo/QdvA3RW8Pph1eDQggagJL9be3YdspH3W QVy0Dg6seWQl71Ub8n01NB+eyk1uKM633MItRfZPpK+sfn8ddCAnEXsRfNCeIFEzLy6Ux N6JlP+wBqIwws4oSUh+g/tx/x7xL365tQ6hexdFFfA8W0Wte6PeOraX0SmHlHV0fFGYzi vtwV0ZtHOE+sW1fiu1nqQsWAY+MgPp2Klxns/VjfeztksOlzzxfmtsqwICdunqV0Dvg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795938652; h=Received:DKIM-Signature:Date:From:To:Cc:Message-ID:In-Reply-To: References:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Correlation-ID; bh=KGUpwze/ip2o93j5A7yKwcD1NYfQl1KRELjozblwuXA=; b=qAG2VLJXaoqkJYepw3bt5ZnzjcFpQIV8RzPRz/H9LjBuGV4qXF6HSobM/HyUmMn7Trfi JXz+I0OQCiXywrdc8zP8nHEeQEMGIbsHSKroLiFPGmk9OnyCNxYxtC5QLTROkF555LDIk +EKIayFaFSiL7TSmNyKlrQJZwAC1z7QWfUovmGOx7YslENfIxLtP8YJniTIKMxcCvHd+I bnUUbdn8asJ+wqbh8fiRHMZtunCS+q4pCSTO/DsorRZChcLMAUn2FaTioJVLkfnlheWAE LguvcY9cpTcgSSRbBhsAxq8dRbICrdNzrqtdzKrOcSxP0J5royTmFIkz5mRXDgddDLQ== 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=QdWIPpEx; 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 B5631606A31C; Sun, 29 Nov 2026 07:50:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D54D51F000C1; Sun, 29 Nov 2026 07:50:49 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795938652; bh=KGUpwze/ip2o93j5A7yKwcD1NYfQl1KRELjozblwuXA=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=QdWIPpExmq/bIodea8NzPSyUOtcaxoMkWKiqpKK7Yfq1j4+md12wjGjv2IG25e5zv cQBg5//nNF/xevHvWQa9BouAy8vubFrYM19qPeMcGmhuep0SzyXg+H+9qwygEgYivI OBmaet52bqEy3TnWDnbLND5mcJb2gHj3gYcGZRYdmRVScEYuuAxUE/uJGgB72W1sQv ytVzRbhLJNs41xMdk+GdqEmEpAJTyMv1yOCegNlSn0RUjKdwESQXvNQc3mNcgjQHlk ZF9RnVtK9T7qno7u9X17ohP3cziUF8MNRzGc9Ye1ItJA7BRUrnGi9mafm4UiWEigv2 vo54vUwTNVFBQ== X-Cc: Paolo Abeni <pabeni@redhat.com>, Eric Dumazet <edumazet@kernel.org>, netdev@vger.kernel.org, mptcp@lists.linux.dev, netdev-bot+sashiko@kernel.org, ncardwell@google.com, kuniyu@google.com, davem@davemloft.net, kuba@kernel.org, horms@kernel.org, martineau@kernel.org, geliang@kernel.org, llleigoing@outlook.com X-In-Reply-To: <20261129063755.1972521-1-llleigoing@gmail.com> 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-Correlation-ID: <a64fbd90-4cba-42b8-977c-ac98171c39e6@kernel.org>