From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D54D51F000C1; Sun, 29 Nov 2026 07:50:49 +0000 (UTC) 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== Date: Sun, 29 Nov 2026 08:50:46 +0100 From: Matthieu Baerts To: Lin Lei Cc: Paolo Abeni , Eric Dumazet , 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 Message-ID: In-Reply-To: <20261129063755.1972521-1-llleigoing@gmail.com> References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com> <179516297347.3136.13553293180683672285@kernel.org> <20261129063755.1972521-1-llleigoing@gmail.com> Subject: Re: [PATCH net 2/3] net: bound receive window predictions before narrowing X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: Hi Lin Lei, Thank you for looking at this issue. 29 Nov 2026 07:38:02 Lin Lei : > 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 =3D=3D 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 <=3D 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 =3D=3D 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 <=3D oldval in > =C2=A0=C2=A0 tcp_rcvbuf_grow(), as Sashiko suggested. > > =C2=A0=C2=A0 This avoids the underflow without affecting tcp_data_queue_o= fo() > =C2=A0=C2=A0 (which passes newval =3D=3D oldval), but pure TCP callers al= ready > =C2=A0=C2=A0 guarantee newval >=3D oldval, and tp->rcvq_space.space =3D n= ewval at the > =C2=A0=C2=A0 top of tcp_rcvbuf_grow() would still move the larger-MTU sub= flow's > =C2=A0=C2=A0 space estimate backwards. > > 2) Option 2: Keep tcp_rcvbuf_grow() unchanged and clamp the sample to > =C2=A0=C2=A0 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_s= ock *msk, int copied) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mptcp_for_each_subflow(msk, su= bflow) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct= sock *ssk; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool s= low; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int space; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ssk = =3D mptcp_subflow_tcp_sock(subflow); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 slow = =3D lock_sock_fast(ssk); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 space =3D t= cp_sk(ssk)->rcvq_space.space; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* sub= flows can be added before tcp_init_transfer() */ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (tcp_sk(= ssk)->rcvq_space.space) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 tcp_rcvbuf_grow(ssk, copied); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (space) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 tcp_rcvbuf_grow(ssk, max(copied, space)); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unlock= _sock_fast(ssk, slow); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0=C2=A0=C2=A0 } > > =C2=A0=C2=A0 Personally, Option 2 seems cleaner to me: it fixes the issue= at the > =C2=A0=C2=A0 only caller that can pass a smaller sample, preserves the su= bflow's > =C2=A0=C2=A0 existing space estimate, zeros the slow-start delta when > =C2=A0=C2=A0 copied < space, and still lets TCP account for its own OOO q= ueue > =C2=A0=C2=A0 (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