From: Paolo Abeni <pabeni@redhat.com>
To: Ziran Zhang <zhangcoder@yeah.net>,
Eric Dumazet <edumazet@google.com>,
Neal Cardwell <ncardwell@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator()
Date: Thu, 3 Sep 2026 10:07:45 +0200 [thread overview]
Message-ID: <da990dc8-a7c5-4870-89f0-ad8e7dad0e0a@redhat.com> (raw)
In-Reply-To: <20260901023539.6986-1-zhangcoder@yeah.net>
On 9/1/26 4:35 AM, 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.
>
> 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
> + */
I'm sorry, I have the feeling the above does not clarify much. Also
AFAICS it's not a 'sharp' drop but any negative delta.
/P
next prev parent reply other threads:[~2026-09-03 8:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 2:35 [PATCH net-next] tcp: fix mdev comment in tcp_rtt_estimator() Ziran Zhang
2026-09-03 8:07 ` Paolo Abeni [this message]
2026-09-03 8:14 ` Eric Dumazet
-- strict thread matches above, loose matches on Subject: below --
2026-08-18 8:51 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da990dc8-a7c5-4870-89f0-ad8e7dad0e0a@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=zhangcoder@yeah.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox