Article View: linux.kernel.netdev
Article #18621[PATCH net v2 0/5] tcp: avoid integer wraps in the RTT estimator and the RTO
From: Chris Mason
Date: Wed, 18 Nov 2026 15:51
Date: Wed, 18 Nov 2026 15:51
55 lines
9231 bytes
9231 bytes
Hi everyone, This is v2 of the RTT clamps, with Eric's review folded in. Patch 1: __tcp_set_rto() never returns 0, so that the backoff recovers from any state of the RTT estimator. Patch 2: tcp_rtt_estimator() clamps each sample to 120 s, so that srtt_us, mdev_us, rttvar_us and the sum in __tcp_set_rto() can't wrap. Patch 3: tcp_rtt_tsopt_us() rejects a TSecr sample above 120 s. Patch 4: new, from Eric's review. tcp_rcv_rtt_update() clamps its samples too, which covers tcp_rcv_rtt_measure(). Patch 5: new. tcp_rto_min() bounds the locked rto_min of a route. Eric, I have a question on patch 5. You pointed at a locked rto_min of 0 for patch 1. We can also get an RTO of 0 out of tcp_init_metrics(), which doesn't go through __tcp_set_rto(), so I bounded the metric in tcp_rto_min(). For a locked cwnd of 0 you wanted ip_metrics_convert() to reject it instead. I didn't do that here because claude points out that "rto_min lock 0" is accepted today and mostly works, but just let me know how you want this to look. Changes since v1: - Patch 1: no code change. New changelog and Fixes: tag (Eric). David suggested "return rto ?: 1;". I kept max(), since tcp_rtt_estimator() ends with max(1U, srtt). - Patch 2: clamp mrtt_us itself, so that tcp_bpf_rtt() gets the clamped sample (Eric). - Patch 3: no code change. The part on sample << 3 moved to patch 4. - Patch 4: new (Eric), with min() instead of min_t() (David). - Patch 5: new. v1: https://lore.kernel.org/all/20261118005048.53393-1-mason@kernel.org/ This is on top of v7.4-rc3. Chris Mason (5): tcp: don't let __tcp_set_rto() return 0 tcp: clamp RTT samples in tcp_rtt_estimator() tcp: reject RTT samples from TSecr above 120 s tcp: clamp the samples in tcp_rcv_rtt_update() tcp: bound the rto_min of a route in tcp_rto_min() include/net/tcp.h | 14 ++++++++++++-- net/ipv4/tcp_input.c | 21 +++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) -- 2.55.0
Technical Details
Message-ID:
<20261118155144.18393-1-mason@kernel.org>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-366256-linux-kernel-netdev=dewy.ruShow 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-366256-linux-kernel-netdev=dewy.ru From: mason@kernel.org (Chris Mason) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 0/5] tcp: avoid integer wraps in the RTT estimator and the RTO Date: Wed, 18 Nov 2026 10:51:44 -0500 Organization: Usenet Network Message-ID: <20261118155144.18393-1-mason@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2633384"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:V5wduBXf2x9tWHz1GyIWFXtveKo= sha256:HZ4dHNKHyN4jQU0rQol8Diq23vd7SBWO64K+zQcYfiA= sha1:wTKYfWJ+Gy4Pxz0yYLlYA7yizzY= sha256:NqN5nbwnaib/jR3pE+y2P7pHbL/CO76vgI7bosrsOAs= 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 D7C9C115317; Wed, 18 Nov 2026 18:52:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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 nqZfcDKFetJS; Wed, 18 Nov 2026 18:52:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366256-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 9DC2711530D; Wed, 18 Nov 2026 18:51:59 +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 6552E317C1; Wed, 18 Nov 2026 15:51:48 +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=1795017108; b=y473q7UAmThH5oj9e0qT41CG++LNPxRKtmguOzBJVK8n9Dwdn9npcwm4OcK+tTh27e1O hHdXo02TG4GOMQC+PKUV+0p1+pon0/pqhyh1dN1MUxnrcWZ/R1TOKgq999qbYvSFloZnb GWqjgtG6b0iYHLdXA4FC2lT2pRp63R0dFYTMyKp7x2++C38eetTKkLun1l1KFFgeHfvKF ATfGoV9gl59uutMTUtu5c4TyzUFgP6AcurqC5zSwz1uNbaXUOLydqXGxTb2UsaioGshQ8 1tb5N8olDdQkwFfvfsc07pyqS1VGEFph7JHhL6T3+zZlcZqN/NZEY5CMJoZjbAFwMPQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795017108; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Subject:Date: Message-ID:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=VXQKShqbqAA5ohxo0SK/295AUZ/WkykTsmpbukJPNWA=; b=s37P5yhmkFUXl9Yp28k7ErPc0jjpe4sLrEdS7p+AyZYs0+j6jHGS6xa5BRykSO6/kSKz 1BULMwGBRA59O+ggVFApbWfgSCplfcfCC8/rYnRbw1bv7a3mrR8jZN95mdvnHTd1jpVq5 JcAS2cdUNhZE04OCCPDzpwNOmFUrlJhkYugwv0JPFvRIxOGljF2snUqRIcbMUMjwJu0gK LelY1hhrFMxtf41EYSDSw72YK/HyGr0Uy99uCi4ntlqB/mTtHF+JPm8A4pnI13pvnADSX cTZ7g9a8jDh5U2lbqB0+xNhvEFMyI48EGGgKgYQ9EjHoRy/hPhaqCQEjUuaxR4URJPQ== 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=Xidddx2s; 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 37F49606A32A; Wed, 18 Nov 2026 15:51:48 +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=Xidddx2s 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=1795017107; b=2afs/fTzG9WIIZY5RtAlZc5PnAekn9Y6SjIfTG8isHUZiWmBv/Bf9rXdk5dM40t3ILty QDkVHocQEHwsql0sHMTTQrQxZZ/ygP/bDIguwWRnvGAgfe1d+pA2GC47g0He30Vc+rsBC VFETg9MmRl/bIxWybqs4WUmi+y9NJd5VKw1YcyA6tUGqUkIlgq3fkT9fgvAbalPlFDl5e TbTqNsp5A3L1sKd4DlUnWjRryCjO0M/vY2r4uC6dLJEKH1vSxScvUa/rAEocd9OECEZC8 baSQOtOWZl/6le9eJfNQyinonzhwbxPlc49UQS8dAf50KnNz7oVxBkJ+pRwTJ508Jow== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795017107; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=VXQKShqbqAA5ohxo0SK/295AUZ/WkykTsmpbukJPNWA=; b=NhTCdgI5/fRBMHFqUeWIfwJaR2ZhHvO1SMZaQWp+rfch0ehdphwAVZlrpItUv3AFCTBU +IuaLRXUsqmPYTGcuUFcoCAkQQhhEYXRW3B/k5/DhahgW9G6R847Tsrxn2Pd/5jiBsJ2g EJj+yswXtmzDRa6b6RD0Bp19bqlujflejPGU61SBMfUE2TW+n9+HaUzNBu9ici7uwr0ik VmNdn2IOZazlsbhzIXGURFPsiF9mqEeCKvlHNKJq+8Fc+0E7pdKvpp0T33jg/gbXOuLKe WP+6Qfy+qqPvkgfrZn/7PeC2PIoodg09GQEKSnYvyrLYu01nTsxUgoWgxG0tnrKzvOQ== 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=Xidddx2s; 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 56A05606A331 for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 15:51:47 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06FD81F000C6; Wed, 18 Nov 2026 15:51:45 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795017107; bh=VXQKShqbqAA5ohxo0SK/295AUZ/WkykTsmpbukJPNWA=; h=From:To:Subject:Date; b=Xidddx2se8FZENP05h8/L/LKqyVOjCUAK8+tHhRw/7G+9p5ZOBCYuvTaL+6kxFzZa zAoEwG7fU6e4UHtcve+YdQWCuEJUUt8KB7XYwYhoaGBW19fzcmJaisCZ1AxmTZU9e6 6mncgniL+HCcwAlDyECYzVe/gAb92OFI5fz4Uh0/Sm4uM6KQOjhBjQOH1LT9fOQwol MoTY/8t0LLFvJgnYGG9uCaflwpGyKTMnWwS5iFHtI+imLbAJibDCRQYjdyJq8SZ9UH ODdJsO4HKT8T4ungaiDTOfClU1hsJBOXur+nRhHaNoEzsqlGk2gxKFSf4IA9LScXo7 lmCuSOStIPgJw== 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