kernel: bump 5.15 to 5.15.155
[openwrt/openwrt.git] / target / linux / generic / backport-4.9 / 024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch
1 From 75eefc6c59fd2c5f1ab95a3a113c217237d12a31 Mon Sep 17 00:00:00 2001
2 From: Eric Dumazet <edumazet@google.com>
3 Date: Sat, 3 Dec 2016 11:14:54 -0800
4 Subject: [PATCH 05/10] tcp: tsq: add a shortcut in tcp_small_queue_check()
5
6 Always allow the two first skbs in write queue to be sent,
7 regardless of sk_wmem_alloc/sk_pacing_rate values.
8
9 This helps a lot in situations where TX completions are delayed either
10 because of driver latencies or softirq latencies.
11
12 Test is done with no cache line misses.
13
14 Signed-off-by: Eric Dumazet <edumazet@google.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17 net/ipv4/tcp_output.c | 9 +++++++++
18 1 file changed, 9 insertions(+)
19
20 --- a/net/ipv4/tcp_output.c
21 +++ b/net/ipv4/tcp_output.c
22 @@ -2131,6 +2131,15 @@ static bool tcp_small_queue_check(struct
23 limit <<= factor;
24
25 if (atomic_read(&sk->sk_wmem_alloc) > limit) {
26 + /* Always send the 1st or 2nd skb in write queue.
27 + * No need to wait for TX completion to call us back,
28 + * after softirq/tasklet schedule.
29 + * This helps when TX completions are delayed too much.
30 + */
31 + if (skb == sk->sk_write_queue.next ||
32 + skb->prev == sk->sk_write_queue.next)
33 + return false;
34 +
35 set_bit(TSQ_THROTTLED, &tcp_sk(sk)->tsq_flags);
36 /* It is possible TX completion already happened
37 * before we set TSQ_THROTTLED, so we must