From: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
kaneshige.kenji@jp.fujitsu.com, izumi.taku@jp.fujitsu.com,
kosaki.motohiro@jp.fujitsu.com, nhorman@tuxdriver.com,
laijs@cn.fujitsu.com, scott.a.mcmillan@intel.com,
rostedt@goodmis.org, eric.dumazet@gmail.com, fweisbec@gmail.com,
mathieu.desnoyers@polymtl.ca
Subject: [RFC PATCH v4 4/5] skb: add tracepoints to freeing skb
Date: Wed, 28 Jul 2010 15:33:57 +0900 [thread overview]
Message-ID: <4C4FCF55.5020600@jp.fujitsu.com> (raw)
In-Reply-To: <4C4FCDA1.3000803@jp.fujitsu.com>
CHANGE-LOG since v3:
-remove tracepoint of dev_kfree_skb_irq and skb_free_datagram_locked.
Insead of them, add trace_kfree_skb before __kfree_skb in net_tx_action and
skb_free_datagram_locked. And there is no change of about the location of
trace_consume_skb to keep a symmetry against trace_kfree_skb.
This patch adds tracepoint to consume_skb and add trace_kfree_skb before
__kfree_skb in skb_free_datagram_locked and net_tx_action.
Combinating with tracepoint on dev_hard_start_xmit, we can check how long it
takes to free transmited packets. And using it, we can calculate how many
packets driver had at that time. It is useful when a drop of transmited packet
is a problem.
sshd-6828 [000] 112689.258154: consume_skb: skbaddr=f2d99bb8
Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
---
include/trace/events/skb.h | 17 +++++++++++++++++
net/core/datagram.c | 1 +
net/core/dev.c | 2 ++
net/core/skbuff.c | 1 +
4 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 4b2be6d..75ce9d5 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -35,6 +35,23 @@ TRACE_EVENT(kfree_skb,
__entry->skbaddr, __entry->protocol, __entry->location)
);
+TRACE_EVENT(consume_skb,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb),
+
+ TP_STRUCT__entry(
+ __field( void *, skbaddr )
+ ),
+
+ TP_fast_assign(
+ __entry->skbaddr = skb;
+ ),
+
+ TP_printk("skbaddr=%p", __entry->skbaddr)
+);
+
TRACE_EVENT(skb_copy_datagram_iovec,
TP_PROTO(const struct sk_buff *skb, int len),
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 251997a..282806b 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -243,6 +243,7 @@ void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb)
unlock_sock_fast(sk, slow);
/* skb is now orphaned, can be freed outside of locked section */
+ trace_kfree_skb(skb, skb_free_datagram_locked);
__kfree_skb(skb);
}
EXPORT_SYMBOL(skb_free_datagram_locked);
diff --git a/net/core/dev.c b/net/core/dev.c
index 9ea9c1e..92d79bf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -131,6 +131,7 @@
#include <linux/random.h>
#include <trace/events/napi.h>
#include <trace/events/net.h>
+#include <trace/events/skb.h>
#include <linux/pci.h>
#include "net-sysfs.h"
@@ -2577,6 +2578,7 @@ static void net_tx_action(struct softirq_action *h)
clist = clist->next;
WARN_ON(atomic_read(&skb->users));
+ trace_kfree_skb(skb, net_tx_action);
__kfree_skb(skb);
}
}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7da58a2..9cb91a5 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -466,6 +466,7 @@ void consume_skb(struct sk_buff *skb)
smp_rmb();
else if (likely(!atomic_dec_and_test(&skb->users)))
return;
+ trace_consume_skb(skb);
__kfree_skb(skb);
}
EXPORT_SYMBOL(consume_skb);
next prev parent reply other threads:[~2010-07-28 6:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 6:26 [RFC PATCH v4 0/5] netdev: show a process of packets Koki Sanagi
2010-07-28 6:29 ` [RFC PATCH v4 1/5] irq: add tracepoint to softirq_raise Koki Sanagi
2010-08-27 12:37 ` Neil Horman
2010-07-28 6:30 ` [RFC PATCH v4 2/5] napi: convert trace_napi_poll to TRACE_EVENT Koki Sanagi
2010-08-27 12:37 ` Neil Horman
2010-07-28 6:31 ` [RFC PATCH v4 3/5] netdev: add tracepoints to netdev layer Koki Sanagi
2010-08-27 12:38 ` Neil Horman
2010-07-28 6:33 ` Koki Sanagi [this message]
2010-08-27 12:38 ` [RFC PATCH v4 4/5] skb: add tracepoints to freeing skb Neil Horman
2010-07-28 6:35 ` [RFC PATCH v4 5/5] perf:add a script shows a process of packet Koki Sanagi
2010-08-27 12:39 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C4FCF55.5020600@jp.fujitsu.com \
--to=sanagi.koki@jp.fujitsu.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=fweisbec@gmail.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=rostedt@goodmis.org \
--cc=scott.a.mcmillan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.