tcp: introduce TCPSpuriousRtxHostQueues SNMP counter
authorEric Dumazet <edumazet@google.com>
Thu, 18 Apr 2013 06:52:51 +0000 (06:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Apr 2013 18:57:25 +0000 (14:57 -0400)
Host queues (Qdisc + NIC) can hold packets so long that TCP can
eventually retransmit a packet before the first transmit even left
the host.

Its not clear right now if we could avoid this in the first place :

- We could arm RTO timer not at the time we enqueue packets, but
  at the time we TX complete them (tcp_wfree())

- Cancel the sending of the new copy of the packet if prior one
  is still in queue.

This patch adds instrumentation so that we can at least see how
often this problem happens.

TCPSpuriousRtxHostQueues SNMP counter is incremented every time
we detect the fast clone is not yet freed in tcp_transmit_skb()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/snmp.h
net/ipv4/proc.c
net/ipv4/tcp_output.c

index e00013a1debcb521751de4b47141eb0fe64ca48d..fefdec91c68b5f20a88cce9ee1942dbc722452ee 100644 (file)
@@ -247,6 +247,7 @@ enum
        LINUX_MIB_TCPFASTOPENPASSIVEFAIL,       /* TCPFastOpenPassiveFail */
        LINUX_MIB_TCPFASTOPENLISTENOVERFLOW,    /* TCPFastOpenListenOverflow */
        LINUX_MIB_TCPFASTOPENCOOKIEREQD,        /* TCPFastOpenCookieReqd */
+       LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
        __LINUX_MIB_MAX
 };
 
index b6f2ea1748988ee4d0a418144d8cb34f055b3378..6da51d55d03a167a33703c1ed57ec7183ab607ae 100644 (file)
@@ -269,6 +269,7 @@ static const struct snmp_mib snmp4_net_list[] = {
        SNMP_MIB_ITEM("TCPFastOpenPassiveFail", LINUX_MIB_TCPFASTOPENPASSIVEFAIL),
        SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW),
        SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD),
+       SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES),
        SNMP_MIB_SENTINEL
 };
 
index d12694353540547f63a207f8176f1e8d6fb485c2..5f28131eb37e35c4f858566e9cd9c6dbf24ff0d9 100644 (file)
@@ -846,6 +846,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
                __net_timestamp(skb);
 
        if (likely(clone_it)) {
+               const struct sk_buff *fclone = skb + 1;
+
+               if (unlikely(skb->fclone == SKB_FCLONE_ORIG &&
+                            fclone->fclone == SKB_FCLONE_CLONE))
+                       NET_INC_STATS_BH(sock_net(sk),
+                                        LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
+
                if (unlikely(skb_cloned(skb)))
                        skb = pskb_copy(skb, gfp_mask);
                else