diff mbox series

[net-next] net: tcp: refresh tcp_mstamp for compressed ack in timer

Message ID 20241003082231.759759-1-dongml2@chinatelecom.cn (mailing list archive)
State Accepted
Commit 269084f748524fa1a3fb8eb530eb70f77e7c3e4a
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: tcp: refresh tcp_mstamp for compressed ack in timer | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Menglong Dong <menglong8.dong@gmail.com>' != 'Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-06--15-00 (tests: 775)

Commit Message

Menglong Dong Oct. 3, 2024, 8:22 a.m. UTC
For now, we refresh the tcp_mstamp for delayed acks and keepalives, but
not for the compressed ack in tcp_compressed_ack_kick().

I have not found out the effact of the tcp_mstamp when sending ack, but
we can still refresh it for the compressed ack to keep consistent.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 net/ipv4/tcp_timer.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Eric Dumazet Oct. 3, 2024, 8:46 a.m. UTC | #1
On Thu, Oct 3, 2024 at 10:23 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
>
> For now, we refresh the tcp_mstamp for delayed acks and keepalives, but
> not for the compressed ack in tcp_compressed_ack_kick().
>
> I have not found out the effact of the tcp_mstamp when sending ack, but
> we can still refresh it for the compressed ack to keep consistent.

This was a choice I made for the following reason :

delayed ack timer can happen sometime 40ms later. Thus the
tcp_mstamp_refresh(tp) was probably welcome.

Compressed ack timer is scheduled for min( 5% of RTT, 1ms). It is
usually in the 200 usec range.

So sending the prior tsval (for flow using TCP TS) was ok (and right
most of the time), and not changing PAWS or EDT logic.

Although I do not object to your patch, there is no strong argument
for it or against it.

Reviewed-by: Eric Dumazet <edumazet@google.com>

>
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
>  net/ipv4/tcp_timer.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index 79064580c8c0..1f37a37f9c82 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -851,6 +851,7 @@ static enum hrtimer_restart tcp_compressed_ack_kick(struct hrtimer *timer)
>                          * LINUX_MIB_TCPACKCOMPRESSED accurate.
>                          */
>                         tp->compressed_ack--;
> +                       tcp_mstamp_refresh(tp);
>                         tcp_send_ack(sk);
>                 }
>         } else {
> --
> 2.39.5
>
Menglong Dong Oct. 6, 2024, 4:23 a.m. UTC | #2
On Thu, Oct 3, 2024 at 4:47 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Thu, Oct 3, 2024 at 10:23 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
> >
> > For now, we refresh the tcp_mstamp for delayed acks and keepalives, but
> > not for the compressed ack in tcp_compressed_ack_kick().
> >
> > I have not found out the effact of the tcp_mstamp when sending ack, but
> > we can still refresh it for the compressed ack to keep consistent.
>
> This was a choice I made for the following reason :
>
> delayed ack timer can happen sometime 40ms later. Thus the
> tcp_mstamp_refresh(tp) was probably welcome.
>
> Compressed ack timer is scheduled for min( 5% of RTT, 1ms). It is
> usually in the 200 usec range.
>

Thanks for the explanation! I'm writing a tool, which tries to capture
the latency from __tcp_transmit_skb() to dev_hard_start_xmit() according
to the skb->tstamp, and the compressed ack case confuses my
application.

Maybe someone else can do similar things, and they can benefit from
this patch too.

Thanks!
Menglong Dong

> So sending the prior tsval (for flow using TCP TS) was ok (and right
> most of the time), and not changing PAWS or EDT logic.
>
> Although I do not object to your patch, there is no strong argument
> for it or against it.
>
> Reviewed-by: Eric Dumazet <edumazet@google.com>
>
> >
> > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > ---
> >  net/ipv4/tcp_timer.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> > index 79064580c8c0..1f37a37f9c82 100644
> > --- a/net/ipv4/tcp_timer.c
> > +++ b/net/ipv4/tcp_timer.c
> > @@ -851,6 +851,7 @@ static enum hrtimer_restart tcp_compressed_ack_kick(struct hrtimer *timer)
> >                          * LINUX_MIB_TCPACKCOMPRESSED accurate.
> >                          */
> >                         tp->compressed_ack--;
> > +                       tcp_mstamp_refresh(tp);
> >                         tcp_send_ack(sk);
> >                 }
> >         } else {
> > --
> > 2.39.5
> >
patchwork-bot+netdevbpf@kernel.org Oct. 7, 2024, 11:40 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  3 Oct 2024 16:22:31 +0800 you wrote:
> For now, we refresh the tcp_mstamp for delayed acks and keepalives, but
> not for the compressed ack in tcp_compressed_ack_kick().
> 
> I have not found out the effact of the tcp_mstamp when sending ack, but
> we can still refresh it for the compressed ack to keep consistent.
> 
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> 
> [...]

Here is the summary with links:
  - [net-next] net: tcp: refresh tcp_mstamp for compressed ack in timer
    https://git.kernel.org/netdev/net-next/c/269084f74852

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 79064580c8c0..1f37a37f9c82 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -851,6 +851,7 @@  static enum hrtimer_restart tcp_compressed_ack_kick(struct hrtimer *timer)
 			 * LINUX_MIB_TCPACKCOMPRESSED accurate.
 			 */
 			tp->compressed_ack--;
+			tcp_mstamp_refresh(tp);
 			tcp_send_ack(sk);
 		}
 	} else {