🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24067

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

#24067
From: Lin Lei
Date: Sun, 29 Nov 2026 06:37
74 lines
13790 bytes
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.

Thanks,
Lin
Technical Details
Message-ID: <20261129063755.1972521-1-llleigoing@gmail.com>
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-373390-linux-kernel-netdev=dewy.ru
References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com> <179516297347.3136.13553293180683672285@kernel.org>

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-373390-linux-kernel-netdev=dewy.ru
From: llleigoing@gmail.com (Lin Lei)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/3] net: bound receive window predictions before narrowing
Date: Sun, 29 Nov 2026 06:37:54 +0000
Organization: Usenet Network
Message-ID: <20261129063755.1972521-1-llleigoing@gmail.com>
References: <20261117052200.1507847-1-llleigoing@outlook.com> <20261117052200.1507847-3-llleigoing@outlook.com> <179516297347.3136.13553293180683672285@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1119411"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:J8gU7U7c2gPMrltBGnfxkDUZVn0= sha256:LO/LJyqWHgGQDnzvocdCr9OJ1MbAx1l4DvEEfugqe4Q=
	sha1:OVH/xfbCTyoawKJq2IcmCNRRzco= sha256:QVMT78hsZUIO7Vn5dyhV6n49lRQxSeyqFAsPDcDXZ/U=
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 BA18C125F95; Sun, 29 Nov 2026 09:38:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=gmail.com
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 g59z1MdZm1Zq;
	Sun, 29 Nov 2026 09:38:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-373390-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A1DF8125F93; Sun, 29 Nov 2026 09:38:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 75E47601C13; Sun, 29 Nov 2026 06:38:04 +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=1795934281;
	b=tWJYyHl5DAvAMeitozFVeP6IPxFnjK7aJytddFEFcnD+4p0QMKV8sP6RwYN7cVWVFc54
	 bFEEnDJwqAy0UDgrOvQjvShjkQA70wpWsi13F3qV/L+PlGR9g60ZCUW7KMT6nbYDB7Qc0
	 bpVqj4GMQhdnjQNNkXPemXOO4MbhzKkmOJAnKyeW5AdgMG3TvjBYsQOJXTPYcjM3vzFpb
	 ypGl/01TwFk7uj5j8O/7PjKFeEiNF03lY+tVypjYtCeSGkq7BEnR6u5v/O1OzgQX4izPA
	 fZJuLf/vCciYRTAzJPIwXZ2Wttm2+tD4H4JBaJi7sxLLX5VnIgesrFundESChukjOvA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795934281;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=J9+el+YwJuwsrteKlF8ICnghurjaumqSjfwtkJi6y2U=;
	b=AnfrmG3/1VT4hslMCrwAQJfcRJAjAjknDQJ1v0RnPsZRlVOSR49KB8AoO/5plkXA4S09
	 7iDVIlaSg3eK+c9bv+EQcdoADCAefk3lm3IB8hSz6CPZSOqTBu4AwNpEqt7SQk09Z8NjE
	 O9+X8fRVjc9k3QXwKYNWUWg/AdSj/rw6UzSRf3HqtfrL8o0zJJMO5jBgCazivhIo7N8Uv
	 FEfSkNa9/wdqswQyfZaIm0H2v+6a5KZb5ILaBAmkRQ4pm+CFTMuev5ZN9FJlTjXb6UOoX
	 LGIH5AadgZp1VYidH9Bm0Be2m4LVTwrBON7amOZcIaxIFeHiH0COOZO23LCY+6xL+AQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dpv3rvd5;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 D429F606A32C;
	Sun, 29 Nov 2026 06:38:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dpv3rvd5
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.181
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795934281;
	b=ZLzPe8AbV2tLfjA6YA4JRqcYzJZfM0N5GV1cl6BL4UiOO4Rt9+arKocNd15GUEN/Sopn
	 IZkFAADVebbqQk4uIDsEm5Df1tvRQXQhNIcRNunWTGtySzEvW/ZjfmSWOeOk15tjvSJfv
	 aF9Lh0suad5Emebr+8+PIf8dwjxJvd0Fi5hWnQ9HNEC3WQaJ71UN9qiQ5cThoFZBq2Elq
	 55UqvJbRKgqtg/X09u1YCkNSrrnzRlGTw7NkP49gqm88d3KzwNwfxvwrHorjr5xlvxWss
	 qkEjAEcIyO0HJZR5anwpY1kpGTMfs2M+Dpdp/6fn31947RS4sgFFrL/NDiLULlevSbw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795934281;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=J9+el+YwJuwsrteKlF8ICnghurjaumqSjfwtkJi6y2U=;
	b=uBbFK0c68ZQW4sPNTQEe+C6LhhmSLRk7LnUXOh2/htBUocsTFOiTXyqWXNdOpfCfpxCb
	 KpoTRvYsx5CnSrei9Wa081vV1A/RGXLHc/XYGUXKc6dRU1h8+Ew0o++wlump+uvTr3dOf
	 50CzhnSM7CxTDIxoEw7cq0CKT0jsYBNZdeZ2D22krLgsfhZnnT5e2Gs6vqup5FWC5geGf
	 dI8uVvFe/rgdIjZ8wDE2Sa/qPlw9rTkJv0+hyDbBu0iZHY9oCIVoZjNyVGDDjG/3ZQbk8
	 lEpwWxOqGUgvrxxaacLJvRwYDYf0AxuQyR2j9dNGJo6He0L38Dota/nNY8aFy1bHrJQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dpv3rvd5;
	arc=none smtp.remote-ip=74.125.82.181
X-Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A072B606A31C
	for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 06:38:00 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A072B606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f181.google.com with SMTP id 5a478bee46e88-386c4d2e2ccso8061317eec.0
        for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 22:38:00 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795934280; x=1796539080; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=J9+el+YwJuwsrteKlF8ICnghurjaumqSjfwtkJi6y2U=;
        b=dpv3rvd5eflaK0MZ46m+bAk67JclpZI0221zmAFPofND6meaD/X8E2kYapGDGTOO71
         o7+iCXeNoL3XEk7XEa0ftjo+a9K5SYL5/IAay4U7GEv9yfzp/PiLN/ul7Bk3zOdPCe09
         G2VylMH1oG3cXxLyzqs6LKZkhB7EGLkyVNBSbxFHSs/gNfIYg0sZyC6MWmsMRepW13+i
         iebietJ4IlPx7u5NDiwY64Emubi4A+lOduWSnySr0hAo1om+1Lor1XQhJ5Djgp7SgRVg
         d0F9aHVljsbKpOwDdV8Q0leJmF9J4FGZ/dtUkt4h+xUdr8P/7cuuTrv1w2G4ULlimqX/
         8tcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795934280; x=1796539080;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=J9+el+YwJuwsrteKlF8IC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A4Z3S3BjIvgtbVS0W+7w/BxI4fK37U6CBu8+dATMgXQds+8cYv0MbtKdC95igoM7
	2Yq6Qg3x9Ma9fTZRxNS30VE+Fx/OTY0yjqVfLsOm9Mpmcg==
X-Received: by 2002:a05:7300:2301:b0:385:4c54:3c8c with SMTP id 5a478bee46e88-3856c0c9403mr42412175eec.1.1795934279524;
        Sat, 28 Nov 2026 22:37:59 -0800 (PST)
X-Received: from localhost ([2605:52c0:1:e99:982a:f6ff:fe2e:6e83])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386aa203267sm54282089eec.0.2026.11.28.22.37.56
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 28 Nov 2026 22:37:59 -0800 (PST)
X-Cc: 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-Mailer: git-send-email 2.43.0
X-In-Reply-To: <179516297347.3136.13553293180683672285@kernel.org>
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