From: Eric Dumazet <hidden> Date: 2021-03-11 20:36:41
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
While problems have been there forever, second patch might
introduce some regressions so I prefer not backport
them to stable releases before things settle.
Many thanks to FB team for their help and tests.
Few packetdrill tests need to be changed to reflect
the improvements brought by this series.
Eric Dumazet (3):
tcp: plug skb_still_in_host_queue() to TSQ
tcp: consider using standard rtx logic in tcp_rcv_fastopen_synack()
tcp: remove obsolete check in __tcp_retransmit_skb()
include/linux/skbuff.h | 2 +-
net/ipv4/tcp_input.c | 10 ++++------
net/ipv4/tcp_output.c | 20 ++++++++------------
3 files changed, 13 insertions(+), 19 deletions(-)
--
2.31.0.rc2.261.g7f71774620-goog
From: Eric Dumazet <hidden> Date: 2021-03-11 20:36:41
From: Eric Dumazet <edumazet@google.com>
Jakub reported Data included in a Fastopen SYN that had to be
retransmit would have to wait for an RTO if TX completions are slow,
even with prior fix.
This is because tcp_rcv_fastopen_synack() does not use standard
rtx logic, meaning TSQ handler exits early in tcp_tsq_write()
because tp->lost_out == tp->retrans_out
Lets make tcp_rcv_fastopen_synack() use standard rtx logic,
by using tcp_mark_skb_lost() on the skb thats needs to be
sent again.
Not this raised a warning in tcp_fastretrans_alert() during my tests
since we consider the data not being aknowledged
by the receiver does not mean packet was lost on the network.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <redacted>
---
net/ipv4/tcp_input.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
@@ -2914,7 +2914,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,/* D. Check state exit conditions. State can be terminated*whenhigh_seqisACKed.*/if(icsk->icsk_ca_state==TCP_CA_Open){-WARN_ON(tp->retrans_out!=0);+WARN_ON(tp->retrans_out!=0&&!tp->syn_data);tp->retrans_stamp=0;}elseif(!before(tp->snd_una,tp->high_seq)){switch(icsk->icsk_ca_state){
From: Eric Dumazet <hidden> Date: 2021-03-11 20:36:41
From: Eric Dumazet <edumazet@google.com>
TSQ provides a nice way to avoid bufferbloat on individual socket,
including retransmit packets. We can get rid of the old
heuristic:
/* Do not sent more than we queued. 1/4 is reserved for possible
* copying overhead: fragmentation, tunneling, mangling etc.
*/
if (refcount_read(&sk->sk_wmem_alloc) >
min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2),
sk->sk_sndbuf))
return -EAGAIN;
This heuristic was giving false positives according to Jakub,
whenever TX completions are delayed above RTT. (Ack packets
are processed by TCP stack before clones are orphaned/freed)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <redacted>
---
net/ipv4/tcp_output.c | 8 --------
1 file changed, 8 deletions(-)
@@ -3151,14 +3151,6 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)if(icsk->icsk_mtup.probe_size)icsk->icsk_mtup.probe_size=0;-/* Do not sent more than we queued. 1/4 is reserved for possible-*copyingoverhead:fragmentation,tunneling,manglingetc.-*/-if(refcount_read(&sk->sk_wmem_alloc)>-min_t(u32,sk->sk_wmem_queued+(sk->sk_wmem_queued>>2),-sk->sk_sndbuf))-return-EAGAIN;-if(skb_still_in_host_queue(sk,skb))return-EBUSY;
From: Eric Dumazet <hidden> Date: 2021-03-11 20:36:41
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
Main issue is that TCP stack has a logic preventing a packet
being retransmit if the prior clone has not yet been
orphaned or freed.
This logic came with commit 1f3279ae0c13 ("tcp: avoid
retransmits of TCP packets hanging in host queues")
Thankfully, in the case skb_still_in_host_queue() detects
the initial clone is still in flight, it can use TSQ logic
that will eventually retry later, at the moment the clone
is freed or orphaned.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Neil Spring <redacted>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <redacted>
---
include/linux/skbuff.h | 2 +-
net/ipv4/tcp_output.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-03-12 18:19:32
On Thu, 11 Mar 2021 12:35:03 -0800 Eric Dumazet wrote:
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
While problems have been there forever, second patch might
introduce some regressions so I prefer not backport
them to stable releases before things settle.
Many thanks to FB team for their help and tests.
Few packetdrill tests need to be changed to reflect
the improvements brought by this series.
FWIW I run some workloads with this for a day and looks good:
Tested-by: Jakub Kicinski <kuba@kernel.org>
Thank you!
On Fri, Mar 12, 2021 at 10:18 AM Jakub Kicinski [off-list ref] wrote:
On Thu, 11 Mar 2021 12:35:03 -0800 Eric Dumazet wrote:
quoted
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
While problems have been there forever, second patch might
introduce some regressions so I prefer not backport
them to stable releases before things settle.
Many thanks to FB team for their help and tests.
Few packetdrill tests need to be changed to reflect
the improvements brought by this series.
FWIW I run some workloads with this for a day and looks good:
Tested-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Yuchung Cheng <redacted>
Thank you Eric for fixing the bug.
On Fri, Mar 12, 2021 at 2:05 PM Yuchung Cheng [off-list ref] wrote:
On Fri, Mar 12, 2021 at 10:18 AM Jakub Kicinski [off-list ref] wrote:
quoted
On Thu, 11 Mar 2021 12:35:03 -0800 Eric Dumazet wrote:
quoted
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
While problems have been there forever, second patch might
introduce some regressions so I prefer not backport
them to stable releases before things settle.
Many thanks to FB team for their help and tests.
Few packetdrill tests need to be changed to reflect
the improvements brought by this series.
FWIW I run some workloads with this for a day and looks good:
Tested-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Yuchung Cheng <redacted>
Thank you Eric for fixing the bug.
The series looks good to me as well.
Re this one:
- WARN_ON(tp->retrans_out != 0);
+ WARN_ON(tp->retrans_out != 0 && !tp->syn_data);
it seems a little unfortunate to lose the power of this WARN_ON for
the lifetime of TFO connections, but I do not have a better idea. :-)
thanks,
neal
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Thu, 11 Mar 2021 12:35:03 -0800 you wrote:
From: Eric Dumazet <edumazet@google.com>
Jakub and Neil reported an increase of RTO timers whenever
TX completions are delayed a bit more (by increasing
NIC TX coalescing parameters)
While problems have been there forever, second patch might
introduce some regressions so I prefer not backport
them to stable releases before things settle.
[...]