tcp: do tcp_mstamp_refresh before retransmits on TSQ handler
Subsystems (3)
When retransmission on TSQ handler was introduced in the commit f9616c35a0d7 ("tcp: implement TSQ for retransmits"), the retransmitted skbs' timestamps were updated on the actual transmission. In the later commit 385e20706fac ("tcp: use tp->tcp_mstamp in output path"), it stops being done so. In the commit, the comment says "We try to refresh tp->tcp_mstamp only when necessary", and at present tcp_tsq_handler and tcp_v4_mtu_reduced applies to this. About the latter, it's okay since it's rare enough.
About the former, even though possible retransmissions on the tasklet comes just after the destructor run in NET_RX softirq handling, the time between them could be nonnegligibly large to the extent that tcp_rack_advance or rto rearming be affected if other (remaining) RX, BLOCK and (preceding) TASKLET sofirq handlings are unexpectedly heavy.
So in the same way as tcp_write_timer_handler does, doing tcp_mstamp_refresh ensures the accuracy of algorithms relying on it.
--- net/ipv4/tcp_output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_output.c +3 -1
@@ -739,8 +739,10 @@ static void tcp_tsq_handler(struct sock *sk)struct tcp_sock *tp =tcp_sk (sk);if (tp->lost_out > tp->retrans_out && - tp->snd_cwnd >tcp_packets_in_flight (tp)) + tp->snd_cwnd >tcp_packets_in_flight (tp)) { +tcp_mstamp_refresh (tp);tcp_xmit_retransmit_queue (sk); + }tcp_write_xmit (sk,tcp_current_mss (sk), tp->nonagle,0 ,GFP_ATOMIC );
Signature · 1 line
2.9.4
David Miller
maintainerFrom: Koichiro Den <[email protected]>
Date: Sun, 22 Oct 2017 13:13:16 +0900
Quoted 15 lines
When retransmission on TSQ handler was introduced in the commit
f9616c35a0d7("tcp: implement TSQ for retransmits"), the retransmitted skbs' timestamps were updated on the actual transmission. In the later commit385e20706fac("tcp: usetp->tcp_mstampin output path"), it stops being done so. In the commit, the comment says "We try to refreshtp->tcp_mstamponly when necessary", and at presenttcp_tsq_handlerandtcp_v4_mtu_reducedapplies to this. About the latter, it's okay since it's rare enough.About the former, even though possible retransmissions on the tasklet comes just after the destructor run in
NET_RXsoftirq handling, the time between them could be nonnegligibly large to the extent thattcp_rack_advanceor rto rearming be affected if other (remaining) RX, BLOCK and (preceding) TASKLET sofirq handlings are unexpectedly heavy.
Quoted 6 lines
So in the same way as
tcp_write_timer_handlerdoes, doingtcp_mstamp_refreshensures the accuracy of algorithms relying on it.Fixes 385e20706fac ("tcp: use tp->tcp_mstamp in output path")Signed-off-by Koichiro Den <[email protected]>Reviewed-by Eric Dumazet <[email protected]>
Applied and queued up for -stable.