f0ae2a938eaf82fdb786aba68395a941b99ff842
[openwrt/openwrt.git] / target / linux / generic / backport-4.9 / 024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch
1 From 12a59abc22d6664f7d3944f625ceefee92de8820 Mon Sep 17 00:00:00 2001
2 From: Eric Dumazet <edumazet@google.com>
3 Date: Sat, 3 Dec 2016 11:14:55 -0800
4 Subject: [PATCH 06/10] tcp: tcp_mtu_probe() is likely to exit early
5
6 Adding a likely() in tcp_mtu_probe() moves its code which used to
7 be inlined in front of tcp_write_xmit()
8
9 We still have a cache line miss to access icsk->icsk_mtup.enabled,
10 we will probably have to reorganize fields to help data locality.
11
12 Signed-off-by: Eric Dumazet <edumazet@google.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15 net/ipv4/tcp_output.c | 18 +++++++++---------
16 1 file changed, 9 insertions(+), 9 deletions(-)
17
18 --- a/net/ipv4/tcp_output.c
19 +++ b/net/ipv4/tcp_output.c
20 @@ -1925,26 +1925,26 @@ static inline void tcp_mtu_check_reprobe
21 */
22 static int tcp_mtu_probe(struct sock *sk)
23 {
24 - struct tcp_sock *tp = tcp_sk(sk);
25 struct inet_connection_sock *icsk = inet_csk(sk);
26 + struct tcp_sock *tp = tcp_sk(sk);
27 struct sk_buff *skb, *nskb, *next;
28 struct net *net = sock_net(sk);
29 - int len;
30 int probe_size;
31 int size_needed;
32 - int copy;
33 + int copy, len;
34 int mss_now;
35 int interval;
36
37 /* Not currently probing/verifying,
38 * not in recovery,
39 * have enough cwnd, and
40 - * not SACKing (the variable headers throw things off) */
41 - if (!icsk->icsk_mtup.enabled ||
42 - icsk->icsk_mtup.probe_size ||
43 - inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
44 - tp->snd_cwnd < 11 ||
45 - tp->rx_opt.num_sacks || tp->rx_opt.dsack)
46 + * not SACKing (the variable headers throw things off)
47 + */
48 + if (likely(!icsk->icsk_mtup.enabled ||
49 + icsk->icsk_mtup.probe_size ||
50 + inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
51 + tp->snd_cwnd < 11 ||
52 + tp->rx_opt.num_sacks || tp->rx_opt.dsack))
53 return -1;
54
55 /* Use binary search for probe_size between tcp_mss_base,