tcp: switch pacing timer to softirq based hrtimer
Subsystems (3)
PATCH v2 1/1 tcp: switch pacing timer to softirq based hrtimer
linux-4.16 got support for softirq based hrtimers. TCP can switch its pacing hrtimer to this variant, since this avoids going through a tasklet and some atomic operations.
pacing timer logic looks like other (jiffies based) tcp timers.
v2: use hrtimer_try_to_cancel() in tcp_clear_xmit_timers()
to correctly release reference on socket if needed.
--- include/net/tcp.h | 4 ++- net/ipv4/tcp_output.c | 69 ++++++++++++++++--------------------------- net/ipv4/tcp_timer.c | 2 +- 3 files changed, 29 insertions(+), 46 deletions(-)
include/net/tcp.h +3 -1
@@ -557,7 +557,9 @@ void tcp_fin(struct sock *sk);void tcp_init_xmit_timers (struct sock *);static inline void tcp_clear_xmit_timers (struct sock *sk) { -hrtimer_cancel (&tcp_sk (sk)->pacing_timer); +if (hrtimer_try_to_cancel (&tcp_sk (sk)->pacing_timer) ==1 ) +sock_put (sk); +inet_csk_clear_xmit_timers (sk); }
net/ipv4/tcp_output.c +25 -44
136 lines not on this page · raw message
net/ipv4/tcp_timer.c +1 -1
@@ -713,6 +713,6 @@ void tcp_init_xmit_timers(struct sock *sk)inet_csk_init_xmit_timers (sk, &tcp_write_timer, &tcp_delack_timer, &tcp_keepalive_timer);hrtimer_init (&tcp_sk (sk)->pacing_timer,CLOCK_MONOTONIC , -HRTIMER_MODE_ABS_PINNED ); +HRTIMER_MODE_ABS_PINNED_SOFT );tcp_sk (sk)->pacing_timer.function = tcp_pace_kick; }
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Thu, 10 May 2018 14:59:43 -0700
Quoted 10 lines
linux-4.16 got support for softirq based hrtimers. TCP can switch its pacing hrtimer to this variant, since this avoids going through a tasklet and some atomic operations.
pacing timer logic looks like other (jiffies based) tcp timers.
v2: use
hrtimer_try_to_cancel()intcp_clear_xmit_timers()
to correctly release reference on socket if needed.Signed-off-by Eric Dumazet <[email protected]>
Looks great, applied, thanks Eric.