From 5d177471344bc3001f1e68aca215cf4eb383cd2e Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Sat, 21 Aug 2010 13:07:26 -0700 Subject: [PATCH] --- yaml --- r: 209703 b: refs/heads/master c: e36c886a0f9d624377977fa6cae309cfd7f362fa h: refs/heads/master i: 209701: 599dd690153466772f07c51d4e4c6b8cc3cd257c 209699: f30e6f999f798397548af7bafbd5615ba6778f0b 209695: fdba08ef5378f11f9a872b87c99b9476fc77de87 v: v3 --- [refs] | 2 +- trunk/include/trace/events/workqueue.h | 62 ++++++++++++++++++++++++++ trunk/kernel/workqueue.c | 9 ++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 trunk/include/trace/events/workqueue.h diff --git a/[refs] b/[refs] index 0eca8a8d5165..904f25d0977f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 69b26c7ad00fd5b6129400725e2ffb95134a0e1b +refs/heads/master: e36c886a0f9d624377977fa6cae309cfd7f362fa diff --git a/trunk/include/trace/events/workqueue.h b/trunk/include/trace/events/workqueue.h new file mode 100644 index 000000000000..49682d7e9d60 --- /dev/null +++ b/trunk/include/trace/events/workqueue.h @@ -0,0 +1,62 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM workqueue + +#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_WORKQUEUE_H + +#include +#include + +/** + * workqueue_execute_start - called immediately before the workqueue callback + * @work: pointer to struct work_struct + * + * Allows to track workqueue execution. + */ +TRACE_EVENT(workqueue_execute_start, + + TP_PROTO(struct work_struct *work), + + TP_ARGS(work), + + TP_STRUCT__entry( + __field( void *, work ) + __field( void *, function) + ), + + TP_fast_assign( + __entry->work = work; + __entry->function = work->func; + ), + + TP_printk("work struct %p: function %pf", __entry->work, __entry->function) +); + +/** + * workqueue_execute_end - called immediately before the workqueue callback + * @work: pointer to struct work_struct + * + * Allows to track workqueue execution. + */ +TRACE_EVENT(workqueue_execute_end, + + TP_PROTO(struct work_struct *work), + + TP_ARGS(work), + + TP_STRUCT__entry( + __field( void *, work ) + ), + + TP_fast_assign( + __entry->work = work; + ), + + TP_printk("work struct %p", __entry->work) +); + + +#endif /* _TRACE_WORKQUEUE_H */ + +/* This part must be outside protection */ +#include diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 2994a0e3a61c..8bd600c020e5 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -35,6 +35,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + #include "workqueue_sched.h" enum { @@ -1790,7 +1793,13 @@ static void process_one_work(struct worker *worker, struct work_struct *work) work_clear_pending(work); lock_map_acquire(&cwq->wq->lockdep_map); lock_map_acquire(&lockdep_map); + trace_workqueue_execute_start(work); f(work); + /* + * While we must be careful to not use "work" after this, the trace + * point will only record its address. + */ + trace_workqueue_execute_end(work); lock_map_release(&lockdep_map); lock_map_release(&cwq->wq->lockdep_map);