024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. Adding a likely() in tcp_mtu_probe() moves its code which used to
  6. be inlined in front of tcp_write_xmit()
  7. We still have a cache line miss to access icsk->icsk_mtup.enabled,
  8. we will probably have to reorganize fields to help data locality.
  9. Signed-off-by: Eric Dumazet <edumazet@google.com>
  10. Signed-off-by: David S. Miller <davem@davemloft.net>
  11. ---
  12. net/ipv4/tcp_output.c | 18 +++++++++---------
  13. 1 file changed, 9 insertions(+), 9 deletions(-)
  14. --- a/net/ipv4/tcp_output.c
  15. +++ b/net/ipv4/tcp_output.c
  16. @@ -1960,26 +1960,26 @@ static bool tcp_can_coalesce_send_queue_
  17. */
  18. static int tcp_mtu_probe(struct sock *sk)
  19. {
  20. - struct tcp_sock *tp = tcp_sk(sk);
  21. struct inet_connection_sock *icsk = inet_csk(sk);
  22. + struct tcp_sock *tp = tcp_sk(sk);
  23. struct sk_buff *skb, *nskb, *next;
  24. struct net *net = sock_net(sk);
  25. - int len;
  26. int probe_size;
  27. int size_needed;
  28. - int copy;
  29. + int copy, len;
  30. int mss_now;
  31. int interval;
  32. /* Not currently probing/verifying,
  33. * not in recovery,
  34. * have enough cwnd, and
  35. - * not SACKing (the variable headers throw things off) */
  36. - if (!icsk->icsk_mtup.enabled ||
  37. - icsk->icsk_mtup.probe_size ||
  38. - inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
  39. - tp->snd_cwnd < 11 ||
  40. - tp->rx_opt.num_sacks || tp->rx_opt.dsack)
  41. + * not SACKing (the variable headers throw things off)
  42. + */
  43. + if (likely(!icsk->icsk_mtup.enabled ||
  44. + icsk->icsk_mtup.probe_size ||
  45. + inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
  46. + tp->snd_cwnd < 11 ||
  47. + tp->rx_opt.num_sacks || tp->rx_opt.dsack))
  48. return -1;
  49. /* Use binary search for probe_size between tcp_mss_base,