Skip to content

Commit 12a59ab

Browse files
edumazetdavem330
authored andcommitted
tcp: tcp_mtu_probe() is likely to exit early
Adding a likely() in tcp_mtu_probe() moves its code which used to be inlined in front of tcp_write_xmit() We still have a cache line miss to access icsk->icsk_mtup.enabled, we will probably have to reorganize fields to help data locality. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 75eefc6 commit 12a59ab

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

net/ipv4/tcp_output.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,26 +1932,26 @@ static inline void tcp_mtu_check_reprobe(struct sock *sk)
19321932
*/
19331933
static int tcp_mtu_probe(struct sock *sk)
19341934
{
1935-
struct tcp_sock *tp = tcp_sk(sk);
19361935
struct inet_connection_sock *icsk = inet_csk(sk);
1936+
struct tcp_sock *tp = tcp_sk(sk);
19371937
struct sk_buff *skb, *nskb, *next;
19381938
struct net *net = sock_net(sk);
1939-
int len;
19401939
int probe_size;
19411940
int size_needed;
1942-
int copy;
1941+
int copy, len;
19431942
int mss_now;
19441943
int interval;
19451944

19461945
/* Not currently probing/verifying,
19471946
* not in recovery,
19481947
* have enough cwnd, and
1949-
* not SACKing (the variable headers throw things off) */
1950-
if (!icsk->icsk_mtup.enabled ||
1951-
icsk->icsk_mtup.probe_size ||
1952-
inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
1953-
tp->snd_cwnd < 11 ||
1954-
tp->rx_opt.num_sacks || tp->rx_opt.dsack)
1948+
* not SACKing (the variable headers throw things off)
1949+
*/
1950+
if (likely(!icsk->icsk_mtup.enabled ||
1951+
icsk->icsk_mtup.probe_size ||
1952+
inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
1953+
tp->snd_cwnd < 11 ||
1954+
tp->rx_opt.num_sacks || tp->rx_opt.dsack))
19551955
return -1;
19561956

19571957
/* Use binary search for probe_size between tcp_mss_base,

0 commit comments

Comments
 (0)