tcp: fill shinfo->gso_size at last moment
authorEric Dumazet <edumazet@google.com>
Thu, 11 Jun 2015 16:15:18 +0000 (09:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jun 2015 23:33:11 +0000 (16:33 -0700)
In commit cd7d8498c9a5 ("tcp: change tcp_skb_pcount() location") we stored
gso_segs in a temporary cache hot location.

This patch does the same for gso_size.

This allows to save 2 cache line misses in tcp xmit path for
the last packet that is considered but not sent because of
various conditions (cwnd, tso defer, receiver window, TSQ...)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp_input.c
net/ipv4/tcp_output.c

index 978cebe..950cfec 100644 (file)
@@ -730,11 +730,14 @@ struct tcp_skb_cb {
                /* Note : tcp_tw_isn is used in input path only
                 *        (isn chosen by tcp_timewait_state_process())
                 *
-                *        tcp_gso_segs is used in write queue only,
-                *        cf tcp_skb_pcount()
+                *        tcp_gso_segs/size are used in write queue only,
+                *        cf tcp_skb_pcount()/tcp_skb_mss()
                 */
                __u32           tcp_tw_isn;
-               __u32           tcp_gso_segs;
+               struct {
+                       u16     tcp_gso_segs;
+                       u16     tcp_gso_size;
+               };
        };
        __u8            tcp_flags;      /* TCP header flags. (tcp[13])  */
 
@@ -790,10 +793,10 @@ static inline void tcp_skb_pcount_add(struct sk_buff *skb, int segs)
        TCP_SKB_CB(skb)->tcp_gso_segs += segs;
 }
 
-/* This is valid iff tcp_skb_pcount() > 1. */
+/* This is valid iff skb is in write queue and tcp_skb_pcount() > 1. */
 static inline int tcp_skb_mss(const struct sk_buff *skb)
 {
-       return skb_shinfo(skb)->gso_size;
+       return TCP_SKB_CB(skb)->tcp_gso_size;
 }
 
 /* Events passed to congestion control interface */
Simple merge
Simple merge