[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49F1A63D.1070202@cn.fujitsu.com>
Date: Fri, 24 Apr 2009 19:45:01 +0800
From: Zhaolei <zhaolei@...fujitsu.com>
To: Ingo Molnar <mingo@...e.hu>
CC: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tom Zanussi <tzanussi@...il.com>, linux-kernel@...r.kernel.org,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH 2/4] workqueue_tracepoint: Add workqueue_flush and worklet_cancel
tracepoint
Ingo Molnar <mingo@...e.hu> wrote:
> This allows the understanding of the life cycle of a workqueue and
> of worklets that enter that workqueue.
Signed-off-by: Zhao Lei <zhaolei@...fujitsu.com>
---
include/trace/events/workqueue.h | 36 ++++++++++++++++++++++++++++++++++++
kernel/workqueue.c | 4 ++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index 36f4939..2e77e84 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -76,6 +76,23 @@ TRACE_EVENT(workqueue_handler_exit,
__entry->thread_pid, __entry->work)
);
+TRACE_EVENT(worklet_cancel,
+
+ TP_PROTO(struct work_struct *work),
+
+ TP_ARGS(work),
+
+ TP_STRUCT__entry(
+ __field(work_func_t, func)
+ ),
+
+ TP_fast_assign(
+ __entry->func = work->func;
+ ),
+
+ TP_printk("func=%pF", __entry->func)
+);
+
/* Trace the creation of one workqueue thread on a cpu */
TRACE_EVENT(workqueue_creation,
@@ -99,6 +116,25 @@ TRACE_EVENT(workqueue_creation,
__entry->thread_pid, __entry->cpu)
);
+TRACE_EVENT(workqueue_flush,
+
+ TP_PROTO(struct task_struct *wq_thread),
+
+ TP_ARGS(wq_thread),
+
+ TP_STRUCT__entry(
+ __array(char, thread_comm, TASK_COMM_LEN)
+ __field(pid_t, thread_pid)
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
+ __entry->thread_pid = wq_thread->pid;
+ ),
+
+ TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid)
+);
+
TRACE_EVENT(workqueue_destruction,
TP_PROTO(struct task_struct *wq_thread),
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index fbcdfa2..99a81ba 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -366,6 +366,8 @@ static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
int active = 0;
struct wq_barrier barr;
+ trace_workqueue_flush(cwq->thread);
+
WARN_ON(cwq->thread == current);
spin_lock_irq(&cwq->lock);
@@ -542,6 +544,8 @@ static int __cancel_work_timer(struct work_struct *work,
{
int ret;
+ trace_worklet_cancel(work);
+
do {
ret = (timer && likely(del_timer(timer)));
if (!ret)
--
1.5.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists