All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next] tcp: do tcp_mstamp_refresh before retransmits on TSQ handler
@ 2017-10-22  3:38 Koichiro Den
  2017-10-22  3:52 ` Eric Dumazet
  0 siblings, 1 reply; 13+ messages in thread
From: Koichiro Den @ 2017-10-22  3:38 UTC (permalink / raw)
  To: netdev; +Cc: eric.dumazet, davem, kuznet, yoshfuji

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.

Signed-off-by: Koichiro Den <den@klaipeden.com>
---
 net/ipv4/tcp_output.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 988733f289c8..7a4d9b719b47 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -743,8 +743,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);
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-10-23  4:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-22  3:38 [net-next] tcp: do tcp_mstamp_refresh before retransmits on TSQ handler Koichiro Den
2017-10-22  3:52 ` Eric Dumazet
2017-10-22  3:52   ` Eric Dumazet
2017-10-22  4:10   ` Koichiro Den
2017-10-22  5:21     ` Eric Dumazet
2017-10-22 12:59       ` Koichiro Den
2017-10-22 16:49         ` Eric Dumazet
2017-10-22 17:11           ` Eric Dumazet
2017-10-23  3:26             ` Koichiro Den
2017-10-23  3:40               ` Eric Dumazet
2017-10-23  4:28                 ` Koichiro Den
2017-10-23  4:31                   ` Eric Dumazet
2017-10-23  4:36                     ` Koichiro Den

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.