Skip to content

Commit 75eefc6

Browse files
edumazetdavem330
authored andcommitted
tcp: tsq: add a shortcut in tcp_small_queue_check()
Always allow the two first skbs in write queue to be sent, regardless of sk_wmem_alloc/sk_pacing_rate values. This helps a lot in situations where TX completions are delayed either because of driver latencies or softirq latencies. Test is done with no cache line misses. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a9b204d commit 75eefc6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/ipv4/tcp_output.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,15 @@ static bool tcp_small_queue_check(struct sock *sk, const struct sk_buff *skb,
20912091
limit <<= factor;
20922092

20932093
if (atomic_read(&sk->sk_wmem_alloc) > limit) {
2094+
/* Always send the 1st or 2nd skb in write queue.
2095+
* No need to wait for TX completion to call us back,
2096+
* after softirq/tasklet schedule.
2097+
* This helps when TX completions are delayed too much.
2098+
*/
2099+
if (skb == sk->sk_write_queue.next ||
2100+
skb->prev == sk->sk_write_queue.next)
2101+
return false;
2102+
20942103
set_bit(TSQ_THROTTLED, &tcp_sk(sk)->tsq_flags);
20952104
/* It is possible TX completion already happened
20962105
* before we set TSQ_THROTTLED, so we must

0 commit comments

Comments
 (0)