net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
Subsystems (3)
PATCH v2 1/1 net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
From: Jason Xing <[email protected]>
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 toicsk->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.
---
v2:
1) nit: alway->always and the indentation style suggested by Simon.
--- net/ipv4/tcp_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_timer.c +3 -1
@@ -599,7 +599,9 @@ void tcp_retransmit_timer(struct sock *sk) tcp_stream_is_thin(tp) && icsk->icsk_retransmits <= TCP_THIN_LINEAR_RETRIES) { icsk->icsk_backoff =0 ; - icsk->icsk_rto =min (__tcp_set_rto (tp),TCP_RTO_MAX ); + icsk->icsk_rto =clamp (__tcp_set_rto (tp), +tcp_rto_min (sk), +TCP_RTO_MAX ); } else if (sk->sk_state != TCP_SYN_SENT || icsk->icsk_backoff > READ_ONCE(net->ipv4.sysctl_tcp_syn_linear_timeouts)) {
Signature · 1 line
2.37.3
Quoted 18 lines · Jason Xing
From: Jason Xing <[email protected]>
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_rtohappens to be zero in the 6th round (which is theTCP_THIN_LINEAR_RETRIESvalue), then it will always be zero due to the changed calculation method intcp_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)= 0Therefore, the timer expires so quickly without any doubt.
Quoted 7 lines
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_MINas 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 <[email protected]>Signed-off-by Jason Xing <[email protected]>
Hello maintainers,
I wonder why someone in the patchwork[1] changed this v2 patch into Superseded status without comments? Should I convert it to a new status or something else?
[1]: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
Thanks,
Jason
Quoted 25 lines
---
v2:
1) nit:alway->alwaysand the indentation style suggested by Simon.--- net/ipv4/tcp_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/ipv4/tcp_timer.c +3
-2@@ -599,7 +599,9 @@ void tcp_retransmit_timer(struct sock *sk) tcp_stream_is_thin(tp) && icsk->icsk_retransmits <= TCP_THIN_LINEAR_RETRIES) { icsk->icsk_backoff =0 ; - icsk->icsk_rto =min (__tcp_set_rto (tp),TCP_RTO_MAX ); + icsk->icsk_rto =clamp (__tcp_set_rto (tp), +tcp_rto_min (sk), +TCP_RTO_MAX ); } else if (sk->sk_state != TCP_SYN_SENT || icsk->icsk_backoff > READ_ONCE(net->ipv4.sysctl_tcp_syn_linear_timeouts)) { --2.37.3
Jakub Kicinski
maintainerQuoted 3 lines · On Tue, 15 Aug 2023 10:08:13 +0800 Jason Xing wrote:
I wonder why someone in the patchwork[1] changed this v2 patch into Superseded status without comments? Should I convert it to a new status or something else?
Ack, looks like a mistake, let me bring it back.
Signature · 1 line
pw-bot: under-review
Quoted 7 lines · Jakub Kicinski
Quoted 3 lines · On Tue, 15 Aug 2023 10:08:13 +0800 Jason Xing wrote:
I wonder why someone in the patchwork[1] changed this v2 patch into Superseded status without comments? Should I convert it to a new status or something else?
Ack, looks like a mistake, let me bring it back.
Thanks.
Jason
Quoted 2 lines
--
pw-bot: under-review
Quoted 18 lines · Jason Xing
From: Jason Xing <[email protected]>
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_rtohappens to be zero in the 6th round (which is theTCP_THIN_LINEAR_RETRIESvalue), then it will always be zero due to the changed calculation method intcp_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)= 0Therefore, the timer expires so quickly without any doubt.
Quoted 7 lines
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_MINas 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 <[email protected]>Signed-off-by Jason Xing <[email protected]>
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Fri, 11 Aug 2023 10:37:47 +0800 you wrote:
From: Jason Xing <[email protected]>
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_rtohappens to be zero in the 6th round (which is theTCP_THIN_LINEAR_RETRIESvalue), then it will always be zero due to the changed calculation method intcp_retransmit_timer()as follows:[...]
Here is the summary with links:
- [v2,net] net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
https://git.kernel.org/netdev/net/c/e4dd0d3a2f64
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html