tcp: use TCP_SKB_CB(skb)->tcp_flags in input path
Input path of TCP do not currently uses TCP_SKB_CB(skb)->tcp_flags, which is only used in output path. tcp_recvmsg(), looks at tcp_hdr(skb)->syn for every skb found in receive queue, and its unfortunate because this bit is located in a cache line right before the payload. We can simplify TCP by copying tcp flags into TCP_SKB_CB(skb)->tcp_flags. This patch does so, and avoids the cache line miss in tcp_recvmsg() Following patches will - allow a segment with FIN being coalesced in tcp_try_coalesce() - simplify tcp_collapse() by not copying the headers. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
13bb5180e8
commit
e11ecddf51
@@ -4093,7 +4093,7 @@ static void tcp_ofo_queue(struct sock *sk)
|
||||
__skb_unlink(skb, &tp->out_of_order_queue);
|
||||
__skb_queue_tail(&sk->sk_receive_queue, skb);
|
||||
tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
|
||||
if (tcp_hdr(skb)->fin)
|
||||
if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
|
||||
tcp_fin(sk);
|
||||
}
|
||||
}
|
||||
@@ -4513,7 +4513,7 @@ restart:
|
||||
* - bloated or contains data before "start" or
|
||||
* overlaps to the next one.
|
||||
*/
|
||||
if (!tcp_hdr(skb)->syn && !tcp_hdr(skb)->fin &&
|
||||
if (!(TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)) &&
|
||||
(tcp_win_from_space(skb->truesize) > skb->len ||
|
||||
before(TCP_SKB_CB(skb)->seq, start))) {
|
||||
end_of_skbs = false;
|
||||
@@ -4532,7 +4532,8 @@ restart:
|
||||
/* Decided to skip this, advance start seq. */
|
||||
start = TCP_SKB_CB(skb)->end_seq;
|
||||
}
|
||||
if (end_of_skbs || tcp_hdr(skb)->syn || tcp_hdr(skb)->fin)
|
||||
if (end_of_skbs ||
|
||||
(TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)))
|
||||
return;
|
||||
|
||||
while (before(start, end)) {
|
||||
@@ -4579,8 +4580,7 @@ restart:
|
||||
skb = tcp_collapse_one(sk, skb, list);
|
||||
if (!skb ||
|
||||
skb == tail ||
|
||||
tcp_hdr(skb)->syn ||
|
||||
tcp_hdr(skb)->fin)
|
||||
(TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user