Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcp: tcp_transmit_skb() optimizations

1) We need to take a timestamp only for skb that should be cloned.

Other skbs are not in write queue and no rtt estimation is done on them.

2) the unlikely() hint is wrong for receivers (they send pure ACK)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: MF Nowlan <fitz@cs.yale.edu>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-By: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
ccdbb6e9 29b67c39

+7 -7
+7 -7
net/ipv4/tcp_output.c
··· 850 850 851 851 BUG_ON(!skb || !tcp_skb_pcount(skb)); 852 852 853 - /* If congestion control is doing timestamping, we must 854 - * take such a timestamp before we potentially clone/copy. 855 - */ 856 - if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP) 857 - __net_timestamp(skb); 858 - 859 - if (likely(clone_it)) { 853 + if (clone_it) { 860 854 const struct sk_buff *fclone = skb + 1; 855 + 856 + /* If congestion control is doing timestamping, we must 857 + * take such a timestamp before we potentially clone/copy. 858 + */ 859 + if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP) 860 + __net_timestamp(skb); 861 861 862 862 if (unlikely(skb->fclone == SKB_FCLONE_ORIG && 863 863 fclone->fclone == SKB_FCLONE_CLONE))