diff options
-rw-r--r-- | include/trace/events/workqueue.h | 32 | ||||
-rw-r--r-- | kernel/workqueue.c | 6 |
2 files changed, 22 insertions, 16 deletions
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index 49682d7e9d60..ec9d7244eb9f 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h | |||
@@ -7,13 +7,7 @@ | |||
7 | #include <linux/tracepoint.h> | 7 | #include <linux/tracepoint.h> |
8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
9 | 9 | ||
10 | /** | 10 | DECLARE_EVENT_CLASS(workqueue_work, |
11 | * workqueue_execute_start - called immediately before the workqueue callback | ||
12 | * @work: pointer to struct work_struct | ||
13 | * | ||
14 | * Allows to track workqueue execution. | ||
15 | */ | ||
16 | TRACE_EVENT(workqueue_execute_start, | ||
17 | 11 | ||
18 | TP_PROTO(struct work_struct *work), | 12 | TP_PROTO(struct work_struct *work), |
19 | 13 | ||
@@ -21,24 +15,22 @@ TRACE_EVENT(workqueue_execute_start, | |||
21 | 15 | ||
22 | TP_STRUCT__entry( | 16 | TP_STRUCT__entry( |
23 | __field( void *, work ) | 17 | __field( void *, work ) |
24 | __field( void *, function) | ||
25 | ), | 18 | ), |
26 | 19 | ||
27 | TP_fast_assign( | 20 | TP_fast_assign( |
28 | __entry->work = work; | 21 | __entry->work = work; |
29 | __entry->function = work->func; | ||
30 | ), | 22 | ), |
31 | 23 | ||
32 | TP_printk("work struct %p: function %pf", __entry->work, __entry->function) | 24 | TP_printk("work struct %p", __entry->work) |
33 | ); | 25 | ); |
34 | 26 | ||
35 | /** | 27 | /** |
36 | * workqueue_execute_end - called immediately before the workqueue callback | 28 | * workqueue_execute_start - called immediately before the workqueue callback |
37 | * @work: pointer to struct work_struct | 29 | * @work: pointer to struct work_struct |
38 | * | 30 | * |
39 | * Allows to track workqueue execution. | 31 | * Allows to track workqueue execution. |
40 | */ | 32 | */ |
41 | TRACE_EVENT(workqueue_execute_end, | 33 | TRACE_EVENT(workqueue_execute_start, |
42 | 34 | ||
43 | TP_PROTO(struct work_struct *work), | 35 | TP_PROTO(struct work_struct *work), |
44 | 36 | ||
@@ -46,15 +38,29 @@ TRACE_EVENT(workqueue_execute_end, | |||
46 | 38 | ||
47 | TP_STRUCT__entry( | 39 | TP_STRUCT__entry( |
48 | __field( void *, work ) | 40 | __field( void *, work ) |
41 | __field( void *, function) | ||
49 | ), | 42 | ), |
50 | 43 | ||
51 | TP_fast_assign( | 44 | TP_fast_assign( |
52 | __entry->work = work; | 45 | __entry->work = work; |
46 | __entry->function = work->func; | ||
53 | ), | 47 | ), |
54 | 48 | ||
55 | TP_printk("work struct %p", __entry->work) | 49 | TP_printk("work struct %p: function %pf", __entry->work, __entry->function) |
56 | ); | 50 | ); |
57 | 51 | ||
52 | /** | ||
53 | * workqueue_execute_end - called immediately before the workqueue callback | ||
54 | * @work: pointer to struct work_struct | ||
55 | * | ||
56 | * Allows to track workqueue execution. | ||
57 | */ | ||
58 | DEFINE_EVENT(workqueue_work, workqueue_execute_end, | ||
59 | |||
60 | TP_PROTO(struct work_struct *work), | ||
61 | |||
62 | TP_ARGS(work) | ||
63 | ); | ||
58 | 64 | ||
59 | #endif /* _TRACE_WORKQUEUE_H */ | 65 | #endif /* _TRACE_WORKQUEUE_H */ |
60 | 66 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 19e4bc15ee99..026f778e879b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -42,9 +42,6 @@ | |||
42 | #include <linux/lockdep.h> | 42 | #include <linux/lockdep.h> |
43 | #include <linux/idr.h> | 43 | #include <linux/idr.h> |
44 | 44 | ||
45 | #define CREATE_TRACE_POINTS | ||
46 | #include <trace/events/workqueue.h> | ||
47 | |||
48 | #include "workqueue_sched.h" | 45 | #include "workqueue_sched.h" |
49 | 46 | ||
50 | enum { | 47 | enum { |
@@ -257,6 +254,9 @@ EXPORT_SYMBOL_GPL(system_long_wq); | |||
257 | EXPORT_SYMBOL_GPL(system_nrt_wq); | 254 | EXPORT_SYMBOL_GPL(system_nrt_wq); |
258 | EXPORT_SYMBOL_GPL(system_unbound_wq); | 255 | EXPORT_SYMBOL_GPL(system_unbound_wq); |
259 | 256 | ||
257 | #define CREATE_TRACE_POINTS | ||
258 | #include <trace/events/workqueue.h> | ||
259 | |||
260 | #define for_each_busy_worker(worker, i, pos, gcwq) \ | 260 | #define for_each_busy_worker(worker, i, pos, gcwq) \ |
261 | for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++) \ | 261 | for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++) \ |
262 | hlist_for_each_entry(worker, pos, &gcwq->busy_hash[i], hentry) | 262 | hlist_for_each_entry(worker, pos, &gcwq->busy_hash[i], hentry) |