]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
authorJason Xing <kernelxing@tencent.com>
Fri, 11 Aug 2023 02:37:47 +0000 (10:37 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:21 +0000 (12:00 +0100)
commit7011be3589931f9040de868c32d5329bede3d94b
tree64ec895b08ec3a9b54a2536246088f9733f55496
parent26b124a2d560c6d0db860149f824e1a2d408bdcf
net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled

BugLink: https://bugs.launchpad.net/bugs/2039110
commit e4dd0d3a2f64b8bd8029ec70f52bdbebd0644408 upstream.

In the real workload, I encountered an issue which could cause the RTO
timer to retransmit the skb per 1ms with linear option enabled. The amount
of lost-retransmitted skbs can go up to 1000+ instantly.

The root cause is that if the icsk_rto happens to be zero in the 6th round
(which is the TCP_THIN_LINEAR_RETRIES value), then it will always be zero
due to the changed calculation method in tcp_retransmit_timer() as follows:

icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);

Above line could be converted to
icsk->icsk_rto = min(0 << 1, TCP_RTO_MAX) = 0

Therefore, the timer expires so quickly without any doubt.

I read through the RFC 6298 and found that the RTO value can be rounded
up to a certain value, in Linux, say TCP_RTO_MIN as default, which is
regarded as the lower bound in this patch as suggested by Eric.

Fixes: 36e31b0af587 ("net: TCP thin linear timeouts")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ipv4/tcp_timer.c