[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVpQUC4W2apjwr87D-bxJgGzyAJ82OPZiKRai6+4TFfre+NQQ@mail.gmail.com>
Date: Mon, 27 Oct 2025 10:33:16 -0700
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Neal Cardwell <ncardwell@...gle.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next] tcp: remove one ktime_get() from recvmsg() fast path
On Fri, Oct 24, 2025 at 5:07 AM Eric Dumazet <edumazet@...gle.com> wrote:
>
> Each time some payload is consumed by user space (recvmsg() and friends),
> TCP calls tcp_rcv_space_adjust() to run DRS algorithm to check
> if an increase of sk->sk_rcvbuf is needed.
>
> This function is based on time sampling, and currently calls
> tcp_mstamp_refresh(tp), which is a wrapper around ktime_get_ns().
>
> ktime_get_ns() has a high cost on some platforms.
> 100+ cycles for rdtscp on AMD EPYC Turin for instance.
>
> We do not have to refresh tp->tcp_mpstamp, using the last cached value
> is enough. We only need to refresh it from __tcp_cleanup_rbuf()
> if an ACK must be sent (this is a rare event).
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...gle.com>
Powered by blists - more mailing lists