diff options
| -rw-r--r-- | include/trace/events/workqueue.h | 92 | ||||
| -rw-r--r-- | kernel/trace/Kconfig | 11 | ||||
| -rw-r--r-- | kernel/workqueue.c | 14 |
3 files changed, 3 insertions, 114 deletions
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h deleted file mode 100644 index d6c974474e70..000000000000 --- a/include/trace/events/workqueue.h +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM workqueue | ||
| 3 | |||
| 4 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_WORKQUEUE_H | ||
| 6 | |||
| 7 | #include <linux/workqueue.h> | ||
| 8 | #include <linux/sched.h> | ||
| 9 | #include <linux/tracepoint.h> | ||
| 10 | |||
| 11 | DECLARE_EVENT_CLASS(workqueue, | ||
| 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 | DEFINE_EVENT(workqueue, workqueue_insertion, | ||
| 34 | |||
| 35 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
| 36 | |||
| 37 | TP_ARGS(wq_thread, work) | ||
| 38 | ); | ||
| 39 | |||
| 40 | DEFINE_EVENT(workqueue, workqueue_execution, | ||
| 41 | |||
| 42 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | ||
| 43 | |||
| 44 | TP_ARGS(wq_thread, work) | ||
| 45 | ); | ||
| 46 | |||
| 47 | /* Trace the creation of one workqueue thread on a cpu */ | ||
| 48 | TRACE_EVENT(workqueue_creation, | ||
| 49 | |||
| 50 | TP_PROTO(struct task_struct *wq_thread, int cpu), | ||
| 51 | |||
| 52 | TP_ARGS(wq_thread, cpu), | ||
| 53 | |||
| 54 | TP_STRUCT__entry( | ||
| 55 | __array(char, thread_comm, TASK_COMM_LEN) | ||
| 56 | __field(pid_t, thread_pid) | ||
| 57 | __field(int, cpu) | ||
| 58 | ), | ||
| 59 | |||
| 60 | TP_fast_assign( | ||
| 61 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
| 62 | __entry->thread_pid = wq_thread->pid; | ||
| 63 | __entry->cpu = cpu; | ||
| 64 | ), | ||
| 65 | |||
| 66 | TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm, | ||
| 67 | __entry->thread_pid, __entry->cpu) | ||
| 68 | ); | ||
| 69 | |||
| 70 | TRACE_EVENT(workqueue_destruction, | ||
| 71 | |||
| 72 | TP_PROTO(struct task_struct *wq_thread), | ||
| 73 | |||
| 74 | TP_ARGS(wq_thread), | ||
| 75 | |||
| 76 | TP_STRUCT__entry( | ||
| 77 | __array(char, thread_comm, TASK_COMM_LEN) | ||
| 78 | __field(pid_t, thread_pid) | ||
| 79 | ), | ||
| 80 | |||
| 81 | TP_fast_assign( | ||
| 82 | memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN); | ||
| 83 | __entry->thread_pid = wq_thread->pid; | ||
| 84 | ), | ||
| 85 | |||
| 86 | TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid) | ||
| 87 | ); | ||
| 88 | |||
| 89 | #endif /* _TRACE_WORKQUEUE_H */ | ||
| 90 | |||
| 91 | /* This part must be outside protection */ | ||
| 92 | #include <trace/define_trace.h> | ||
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 8b1797c4545b..a0d95c1f3f82 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
| @@ -391,17 +391,6 @@ config KMEMTRACE | |||
| 391 | 391 | ||
| 392 | If unsure, say N. | 392 | If unsure, say N. |
| 393 | 393 | ||
| 394 | config WORKQUEUE_TRACER | ||
| 395 | bool "Trace workqueues" | ||
| 396 | select GENERIC_TRACER | ||
| 397 | help | ||
| 398 | The workqueue tracer provides some statistical information | ||
| 399 | about each cpu workqueue thread such as the number of the | ||
| 400 | works inserted and executed since their creation. It can help | ||
| 401 | to evaluate the amount of work each of them has to perform. | ||
| 402 | For example it can help a developer to decide whether he should | ||
| 403 | choose a per-cpu workqueue instead of a singlethreaded one. | ||
| 404 | |||
| 405 | config BLK_DEV_IO_TRACE | 394 | config BLK_DEV_IO_TRACE |
| 406 | bool "Support for tracing block IO actions" | 395 | bool "Support for tracing block IO actions" |
| 407 | depends on SYSFS | 396 | depends on SYSFS |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 8e3082b76c7f..f7ab703285a6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -33,8 +33,6 @@ | |||
| 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 | #define CREATE_TRACE_POINTS | ||
| 37 | #include <trace/events/workqueue.h> | ||
| 38 | 36 | ||
| 39 | /* | 37 | /* |
| 40 | * Structure fields follow one of the following exclusion rules. | 38 | * Structure fields follow one of the following exclusion rules. |
| @@ -243,10 +241,10 @@ static inline void clear_wq_data(struct work_struct *work) | |||
| 243 | atomic_long_set(&work->data, work_static(work)); | 241 | atomic_long_set(&work->data, work_static(work)); |
| 244 | } | 242 | } |
| 245 | 243 | ||
| 246 | static inline | 244 | static inline struct cpu_workqueue_struct *get_wq_data(struct work_struct *work) |
| 247 | struct cpu_workqueue_struct *get_wq_data(struct work_struct *work) | ||
| 248 | { | 245 | { |
| 249 | return (void *) (atomic_long_read(&work->data) & WORK_STRUCT_WQ_DATA_MASK); | 246 | return (void *)(atomic_long_read(&work->data) & |
| 247 | WORK_STRUCT_WQ_DATA_MASK); | ||
| 250 | } | 248 | } |
| 251 | 249 | ||
| 252 | /** | 250 | /** |
| @@ -265,8 +263,6 @@ static void insert_work(struct cpu_workqueue_struct *cwq, | |||
| 265 | struct work_struct *work, struct list_head *head, | 263 | struct work_struct *work, struct list_head *head, |
| 266 | unsigned int extra_flags) | 264 | unsigned int extra_flags) |
| 267 | { | 265 | { |
| 268 | trace_workqueue_insertion(cwq->thread, work); | ||
| 269 | |||
| 270 | /* we own @work, set data and link */ | 266 | /* we own @work, set data and link */ |
| 271 | set_wq_data(work, cwq, extra_flags); | 267 | set_wq_data(work, cwq, extra_flags); |
| 272 | 268 | ||
| @@ -431,7 +427,6 @@ static void process_one_work(struct cpu_workqueue_struct *cwq, | |||
| 431 | struct lockdep_map lockdep_map = work->lockdep_map; | 427 | struct lockdep_map lockdep_map = work->lockdep_map; |
| 432 | #endif | 428 | #endif |
| 433 | /* claim and process */ | 429 | /* claim and process */ |
| 434 | trace_workqueue_execution(cwq->thread, work); | ||
| 435 | debug_work_deactivate(work); | 430 | debug_work_deactivate(work); |
| 436 | cwq->current_work = work; | 431 | cwq->current_work = work; |
| 437 | list_del_init(&work->entry); | 432 | list_del_init(&work->entry); |
| @@ -1017,8 +1012,6 @@ static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) | |||
| 1017 | return PTR_ERR(p); | 1012 | return PTR_ERR(p); |
| 1018 | cwq->thread = p; | 1013 | cwq->thread = p; |
| 1019 | 1014 | ||
| 1020 | trace_workqueue_creation(cwq->thread, cpu); | ||
| 1021 | |||
| 1022 | return 0; | 1015 | return 0; |
| 1023 | } | 1016 | } |
| 1024 | 1017 | ||
| @@ -1123,7 +1116,6 @@ static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq) | |||
| 1123 | * checks list_empty(), and a "normal" queue_work() can't use | 1116 | * checks list_empty(), and a "normal" queue_work() can't use |
| 1124 | * a dead CPU. | 1117 | * a dead CPU. |
| 1125 | */ | 1118 | */ |
| 1126 | trace_workqueue_destruction(cwq->thread); | ||
| 1127 | kthread_stop(cwq->thread); | 1119 | kthread_stop(cwq->thread); |
| 1128 | cwq->thread = NULL; | 1120 | cwq->thread = NULL; |
| 1129 | } | 1121 | } |
