Skip to content

Commit f4dae54

Browse files
edumazetdavem330
authored andcommitted
tcp: plug skb_still_in_host_queue() to TSQ
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 1f3279a ("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 <ntspring@fb.com> Reported-by: Jakub Kicinski <kuba@kernel.org> Cc: Neal Cardwell <ncardwell@google.com> Cc: Yuchung Cheng <ycheng@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8176f8c commit f4dae54

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

include/linux/skbuff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ static inline bool skb_fclone_busy(const struct sock *sk,
11401140

11411141
return skb->fclone == SKB_FCLONE_ORIG &&
11421142
refcount_read(&fclones->fclone_ref) > 1 &&
1143-
fclones->skb2.sk == sk;
1143+
READ_ONCE(fclones->skb2.sk) == sk;
11441144
}
11451145

11461146
/**

net/ipv4/tcp_output.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,13 +2775,17 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto)
27752775
* a packet is still in a qdisc or driver queue.
27762776
* In this case, there is very little point doing a retransmit !
27772777
*/
2778-
static bool skb_still_in_host_queue(const struct sock *sk,
2778+
static bool skb_still_in_host_queue(struct sock *sk,
27792779
const struct sk_buff *skb)
27802780
{
27812781
if (unlikely(skb_fclone_busy(sk, skb))) {
2782-
NET_INC_STATS(sock_net(sk),
2783-
LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
2784-
return true;
2782+
set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags);
2783+
smp_mb__after_atomic();
2784+
if (skb_fclone_busy(sk, skb)) {
2785+
NET_INC_STATS(sock_net(sk),
2786+
LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
2787+
return true;
2788+
}
27852789
}
27862790
return false;
27872791
}

0 commit comments

Comments
 (0)