diff options
-rw-r--r-- | include/trace/events/workqueue.h | 100 | ||||
-rw-r--r-- | include/trace/workqueue.h | 25 | ||||
-rw-r--r-- | kernel/trace/trace_workqueue.c | 2 | ||||
-rw-r--r-- | kernel/workqueue.c | 11 |
4 files changed, 103 insertions, 35 deletions
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h new file mode 100644 index 000000000000..035f1bff288e --- /dev/null +++ b/include/trace/events/workqueue.h | |||
@@ -0,0 +1,100 @@ | |||
1 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define _TRACE_WORKQUEUE_H | ||
3 | |||
4 | #include <linux/workqueue.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/tracepoint.h> | ||
7 | |||
8 | #undef TRACE_SYSTEM | ||
9 | #define TRACE_SYSTEM workqueue | ||
10 | |||
11 | TRACE_EVENT(workqueue_insertion, | ||
12 | |||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
14 | |||
15 | TP_ARGS(wq_thread, work), | ||
16 | |||
17 | TP_STRUCT__entry( | ||
18 | __array(char, thread_comm, TASK_COMM_LEN) | ||
19 | __field(pid_t, thread_pid) | ||
20 | __field(work_func_t, func) | ||
21 | ), | ||
22 | |||
23 | TP_fast_assign( | ||
24 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
25 | __entry->thread_pid = wq_thread->pid; | ||
26 | __entry->func = work->func; | ||
27 | ), | ||
28 | |||
29 | TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, | ||
30 | __entry->thread_pid, __entry->func) | ||
31 | ); | ||
32 | |||
33 | TRACE_EVENT(workqueue_execution, | ||
34 | |||
35 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
36 | |||
37 | TP_ARGS(wq_thread, work), | ||
38 | |||
39 | TP_STRUCT__entry( | ||
40 | __array(char, thread_comm, TASK_COMM_LEN) | ||
41 | __field(pid_t, thread_pid) | ||
42 | __field(work_func_t, func) | ||
43 | ), | ||
44 | |||
45 | TP_fast_assign( | ||
46 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
47 | __entry->thread_pid = wq_thread->pid; | ||
48 | __entry->func = work->func; | ||
49 | ), | ||
50 | |||
51 | TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, | ||
52 | __entry->thread_pid, __entry->func) | ||
53 | ); | ||
54 | |||
55 | /* Trace the creation of one workqueue thread on a cpu */ | ||
56 | TRACE_EVENT(workqueue_creation, | ||
57 | |||
58 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
59 | |||
60 | TP_ARGS(wq_thread, cpu), | ||
61 | |||
62 | TP_STRUCT__entry( | ||
63 | __array(char, thread_comm, TASK_COMM_LEN) | ||
64 | __field(pid_t, thread_pid) | ||
65 | __field(int, cpu) | ||
66 | ), | ||
67 | |||
68 | TP_fast_assign( | ||
69 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
70 | __entry->thread_pid = wq_thread->pid; | ||
71 | __entry->cpu = cpu; | ||
72 | ), | ||
73 | |||
74 | TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm, | ||
75 | __entry->thread_pid, __entry->cpu) | ||
76 | ); | ||
77 | |||
78 | TRACE_EVENT(workqueue_destruction, | ||
79 | |||
80 | TP_PROTO(struct task_struct *wq_thread), | ||
81 | |||
82 | TP_ARGS(wq_thread), | ||
83 | |||
84 | TP_STRUCT__entry( | ||
85 | __array(char, thread_comm, TASK_COMM_LEN) | ||
86 | __field(pid_t, thread_pid) | ||
87 | ), | ||
88 | |||
89 | TP_fast_assign( | ||
90 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
91 | __entry->thread_pid = wq_thread->pid; | ||
92 | ), | ||
93 | |||
94 | TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid) | ||
95 | ); | ||
96 | |||
97 | #endif /* _TRACE_WORKQUEUE_H */ | ||
98 | |||
99 | /* This part must be outside protection */ | ||
100 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h deleted file mode 100644 index 7626523deeba..000000000000 --- a/include/trace/workqueue.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #ifndef __TRACE_WORKQUEUE_H | ||
2 | #define __TRACE_WORKQUEUE_H | ||
3 | |||
4 | #include <linux/tracepoint.h> | ||
5 | #include <linux/workqueue.h> | ||
6 | #include <linux/sched.h> | ||
7 | |||
8 | DECLARE_TRACE(workqueue_insertion, | ||
9 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
10 | TP_ARGS(wq_thread, work)); | ||
11 | |||
12 | DECLARE_TRACE(workqueue_execution, | ||
13 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
14 | TP_ARGS(wq_thread, work)); | ||
15 | |||
16 | /* Trace the creation of one workqueue thread on a cpu */ | ||
17 | DECLARE_TRACE(workqueue_creation, | ||
18 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
19 | TP_ARGS(wq_thread, cpu)); | ||
20 | |||
21 | DECLARE_TRACE(workqueue_destruction, | ||
22 | TP_PROTO(struct task_struct *wq_thread), | ||
23 | TP_ARGS(wq_thread)); | ||
24 | |||
25 | #endif /* __TRACE_WORKQUEUE_H */ | ||
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c index 984b9175c13d..cfe56d31d85b 100644 --- a/kernel/trace/trace_workqueue.c +++ b/kernel/trace/trace_workqueue.c | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
9 | #include <trace/workqueue.h> | 9 | #include <trace/events/workqueue.h> |
10 | #include <linux/list.h> | 10 | #include <linux/list.h> |
11 | #include <linux/percpu.h> | 11 | #include <linux/percpu.h> |
12 | #include "trace_stat.h" | 12 | #include "trace_stat.h" |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f71fb2a08950..0668795d8818 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -33,7 +33,8 @@ | |||
33 | #include <linux/kallsyms.h> | 33 | #include <linux/kallsyms.h> |
34 | #include <linux/debug_locks.h> | 34 | #include <linux/debug_locks.h> |
35 | #include <linux/lockdep.h> | 35 | #include <linux/lockdep.h> |
36 | #include <trace/workqueue.h> | 36 | #define CREATE_TRACE_POINTS |
37 | #include <trace/events/workqueue.h> | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * The per-CPU workqueue (if single thread, we always use the first | 40 | * The per-CPU workqueue (if single thread, we always use the first |
@@ -124,8 +125,6 @@ struct cpu_workqueue_struct *get_wq_data(struct work_struct *work) | |||
124 | return (void *) (atomic_long_read(&work->data) & WORK_STRUCT_WQ_DATA_MASK); | 125 | return (void *) (atomic_long_read(&work->data) & WORK_STRUCT_WQ_DATA_MASK); |
125 | } | 126 | } |
126 | 127 | ||
127 | DEFINE_TRACE(workqueue_insertion); | ||
128 | |||
129 | static void insert_work(struct cpu_workqueue_struct *cwq, | 128 | static void insert_work(struct cpu_workqueue_struct *cwq, |
130 | struct work_struct *work, struct list_head *head) | 129 | struct work_struct *work, struct list_head *head) |
131 | { | 130 | { |
@@ -262,8 +261,6 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
262 | } | 261 | } |
263 | EXPORT_SYMBOL_GPL(queue_delayed_work_on); | 262 | EXPORT_SYMBOL_GPL(queue_delayed_work_on); |
264 | 263 | ||
265 | DEFINE_TRACE(workqueue_execution); | ||
266 | |||
267 | static void run_workqueue(struct cpu_workqueue_struct *cwq) | 264 | static void run_workqueue(struct cpu_workqueue_struct *cwq) |
268 | { | 265 | { |
269 | spin_lock_irq(&cwq->lock); | 266 | spin_lock_irq(&cwq->lock); |
@@ -753,8 +750,6 @@ init_cpu_workqueue(struct workqueue_struct *wq, int cpu) | |||
753 | return cwq; | 750 | return cwq; |
754 | } | 751 | } |
755 | 752 | ||
756 | DEFINE_TRACE(workqueue_creation); | ||
757 | |||
758 | static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) | 753 | static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) |
759 | { | 754 | { |
760 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | 755 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; |
@@ -860,8 +855,6 @@ struct workqueue_struct *__create_workqueue_key(const char *name, | |||
860 | } | 855 | } |
861 | EXPORT_SYMBOL_GPL(__create_workqueue_key); | 856 | EXPORT_SYMBOL_GPL(__create_workqueue_key); |
862 | 857 | ||
863 | DEFINE_TRACE(workqueue_destruction); | ||
864 | |||
865 | static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq) | 858 | static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq) |
866 | { | 859 | { |
867 | /* | 860 | /* |