]> www.infradead.org Git - users/dwmw2/linux.git/commit
tcp: add a fast path in tcp_delack_timer()
authorEric Dumazet <edumazet@google.com>
Wed, 2 Oct 2024 17:30:42 +0000 (17:30 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 4 Oct 2024 22:34:40 +0000 (15:34 -0700)
commit81df4fa94ee8c0800ed42c47357435602ed105ad
treedf289ef19ee340cfcca7a6582f13037978ae706f
parent3b784293016252118ed3b42c5479f20f89a0f384
tcp: add a fast path in tcp_delack_timer()

delack timer is not stopped from inet_csk_clear_xmit_timer()
because we do not define INET_CSK_CLEAR_TIMERS.

This is a conscious choice : inet_csk_clear_xmit_timer()
is often called from another cpu. Calling del_timer()
would cause false sharing and lock contention.

This means that very often, tcp_delack_timer() is called
at the timer expiration, while there is no ACK to transmit.

This can be detected very early, avoiding the socket spinlock.

Notes:
- test about tp->compressed_ack is racy,
  but in the unlikely case there is a race, the dedicated
  compressed_ack_timer hrtimer would close it.

- Even if the fast path is not taken, reading
  icsk->icsk_ack.pending and tp->compressed_ack
  before acquiring the socket spinlock reduces
  acquisition time and chances of contention.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241002173042.917928-4-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/inet_connection_sock.h
net/ipv4/inet_connection_sock.c
net/ipv4/tcp_output.c
net/ipv4/tcp_timer.c
net/mptcp/protocol.c