* [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
@ 2026-08-18 8:51 Ziran Zhang
2026-08-18 15:13 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Ziran Zhang @ 2026-08-18 8:51 UTC (permalink / raw)
To: Eric Dumazet, Neal Cardwell, David S . Miller, Jakub Kicinski,
Paolo Abeni
Cc: Kuniyuki Iwashima, Simon Horman, linux-kernel, netdev,
Ziran Zhang
The old comment "mdev = 3/4 mdev + 1/4 new" only describes the
common case. However, when RTT drops sharply, the code applies
a finer gain of 1/32 instead of 1/4, resulting in:
mdev = 31/32 mdev + 1/32 * new.
Express both cases with a unified formula using variable
gain g.
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
---
net/ipv4/tcp_input.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0f60a1dbf..2c9feb181 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1108,7 +1108,10 @@ static void tcp_rtt_estimator(struct sock *sk, long mrtt_us)
} else {
m -= (tp->mdev_us >> 2); /* similar update on mdev */
}
- tp->mdev_us += m; /* mdev = 3/4 mdev + 1/4 new */
+ tp->mdev_us += m; /*
+ * mdev = (1-g)*mdev + g*new, g=1/4 normally,
+ * g=1/32 on sharp RTT drop
+ */
if (tp->mdev_us > tp->mdev_max_us) {
tp->mdev_max_us = tp->mdev_us;
if (tp->mdev_max_us > tp->rttvar_us)
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
2026-08-18 8:51 [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator() Ziran Zhang
@ 2026-08-18 15:13 ` Jakub Kicinski
2026-08-18 15:42 ` Ziran Zhang
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2026-08-18 15:13 UTC (permalink / raw)
To: Ziran Zhang
Cc: Eric Dumazet, Neal Cardwell, David S . Miller, Paolo Abeni,
Kuniyuki Iwashima, Simon Horman, linux-kernel, netdev
On Tue, 18 Aug 2026 16:51:53 +0800 Ziran Zhang wrote:
> The old comment "mdev = 3/4 mdev + 1/4 new" only describes the
> common case. However, when RTT drops sharply, the code applies
> a finer gain of 1/32 instead of 1/4, resulting in:
> mdev = 31/32 mdev + 1/32 * new.
>
> Express both cases with a unified formula using variable
> gain g.
## Form letter - net-next-closed
The merge window for v7.3 has started, and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We will only consider applying net-next patches which were posted
before the announcement:
https://lore.kernel.org/20260816155953.072d73da@kernel.org
Fixes are obviously welcome at any time. net-next patches may be sent
for review and discussion only with an RFC tag.
Please repost when net-next reopens.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer
pv-bot: closed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
2026-08-18 15:13 ` Jakub Kicinski
@ 2026-08-18 15:42 ` Ziran Zhang
2026-08-18 15:53 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Ziran Zhang @ 2026-08-18 15:42 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Neal Cardwell, David S . Miller, Paolo Abeni,
Kuniyuki Iwashima, Simon Horman, linux-kernel, netdev,
Ziran Zhang
On Tue, 18 Aug 2026 08:13:46 -0700 Jakub Kicinski wrote:
> ## Form letter - net-next-closed
>
> The merge window for v7.3 has started, and therefore net-next is closed
> for new drivers, features, code refactoring and optimizations.
> We will only consider applying net-next patches which were posted
> before the announcement:
>
> https://lore.kernel.org/20260816155953.072d73da@kernel.org
>
> Fixes are obviously welcome at any time. net-next patches may be sent
> for review and discussion only with an RFC tag.
>
> Please repost when net-next reopens.
>
> See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
> --
> pw-bot: defer
> pv-bot: closed
Hi Jakub,
Thanks for your reply.
I understand that net-next is currently closed. I will wait for it to reopen
and then resubmit the patch.
Thanks,
Ziran Zhang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
2026-08-18 15:42 ` Ziran Zhang
@ 2026-08-18 15:53 ` Jakub Kicinski
2026-08-18 16:03 ` Ziran Zhang
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2026-08-18 15:53 UTC (permalink / raw)
To: Ziran Zhang
Cc: Eric Dumazet, Neal Cardwell, David S . Miller, Paolo Abeni,
Kuniyuki Iwashima, Simon Horman, linux-kernel, netdev
On Tue, 18 Aug 2026 23:42:53 +0800 Ziran Zhang wrote:
> Thanks for your reply.
>
> I understand that net-next is currently closed. I will wait for it to reopen
> and then resubmit the patch.
TBH I'm not sure this patch is worth the review overhead in the first
place.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
2026-08-18 15:53 ` Jakub Kicinski
@ 2026-08-18 16:03 ` Ziran Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Ziran Zhang @ 2026-08-18 16:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Eric Dumazet, Neal Cardwell, David S . Miller, Paolo Abeni,
Kuniyuki Iwashima, Simon Horman, linux-kernel, netdev,
Ziran Zhang
On Tue, 18 Aug 2026 08:53:54 -0700, Jakub Kicinski wrote:
> TBH I'm not sure this patch is worth the review overhead in the first
> place.
Hi Jakub,
Thanks for your feedback.
I understand the concern about review overhead. The reason I think this
patch is worthwhile is that the current comment has been misleading for
years. It only describes the common case but omits the sharp RTT drop
case, which can confuse developers (especially newbies) trying to
understand the RTO calculation logic.
If you still think this fix is not worth a standalone patch, I'm happy
to follow your suggestion on how to best get it in.
Thanks,
Ziran Zhang
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-18 16:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 8:51 [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator() Ziran Zhang
2026-08-18 15:13 ` Jakub Kicinski
2026-08-18 15:42 ` Ziran Zhang
2026-08-18 15:53 ` Jakub Kicinski
2026-08-18 16:03 ` Ziran Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.