aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-09-27 12:50:57 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-28 16:35:43 -0400
commit971f10eca186cab238c49daa91f703c5a001b0b1 (patch)
tree0d769e6155899c89ae95c3e31c79ce011eb96a39 /net/ipv4/tcp_output.c
parenta224772db8420ecb7ce91a9ba5d535ee3a50d982 (diff)
tcp: better TCP_SKB_CB layout to reduce cache line misses
TCP maintains lists of skb in write queue, and in receive queues (in order and out of order queues) Scanning these lists both in input and output path usually requires access to skb->next, TCP_SKB_CB(skb)->seq, and TCP_SKB_CB(skb)->end_seq These fields are currently in two different cache lines, meaning we waste lot of memory bandwidth when these queues are big and flows have either packet drops or packet reorders. We can move TCP_SKB_CB(skb)->header at the end of TCP_SKB_CB, because this header is not used in fast path. This allows TCP to search much faster in the skb lists. Even with regular flows, we save one cache line miss in fast path. Thanks to Christoph Paasch for noticing we need to cleanup skb->cb[] (IPCB/IP6CB) before entering IP stack in tx path, and that I forgot IPCB use in tcp_v4_hnd_req() and tcp_v4_save_options(). Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f173b1c4f815..a462fb1db896 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -974,6 +974,11 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
974 974
975 /* Our usage of tstamp should remain private */ 975 /* Our usage of tstamp should remain private */
976 skb->tstamp.tv64 = 0; 976 skb->tstamp.tv64 = 0;
977
978 /* Cleanup our debris for IP stacks */
979 memset(skb->cb, 0, max(sizeof(struct inet_skb_parm),
980 sizeof(struct inet6_skb_parm)));
981
977 err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); 982 err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl);
978 983
979 if (likely(err <= 0)) 984 if (likely(err <= 0))