Skip to content

Commit

Permalink
tcp: remove conditional branches from tcp_mstamp_refresh()
Browse files Browse the repository at this point in the history
tcp_clock_ns() (aka ktime_get_ns()) is using monotonic clock,
so the checks we had in tcp_mstamp_refresh() are no longer
relevant.

This patch removes cpu stall (when the cache line is not hot)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Mar 24, 2019
1 parent a7a01ab commit e6d1407
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ void tcp_mstamp_refresh(struct tcp_sock *tp)
{
u64 val = tcp_clock_ns();

if (val > tp->tcp_clock_cache)
tp->tcp_clock_cache = val;

val = div_u64(val, NSEC_PER_USEC);
if (val > tp->tcp_mstamp)
tp->tcp_mstamp = val;
tp->tcp_clock_cache = val;
tp->tcp_mstamp = div_u64(val, NSEC_PER_USEC);
}

static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
Expand Down

0 comments on commit e6d1407

Please sign in to comment.