]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/workqueue.c
workqueue: Add basic tracepoints to track workqueue execution
[net-next-2.6.git] / kernel / workqueue.c
index 9ca34cddaf6d961c1e07bee9080ff4dd6be1338e..8bd600c020e5cdf5f2454681bc2e89fcc99c47d0 100644 (file)
@@ -35,6 +35,9 @@
 #include <linux/lockdep.h>
 #include <linux/idr.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/workqueue.h>
+
 #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);
 
@@ -2568,7 +2577,7 @@ EXPORT_SYMBOL(schedule_delayed_work_on);
 int schedule_on_each_cpu(work_func_t func)
 {
        int cpu;
-       struct work_struct *works;
+       struct work_struct __percpu *works;
 
        works = alloc_percpu(struct work_struct);
        if (!works)
@@ -3527,7 +3536,7 @@ static int __init init_workqueues(void)
        unsigned int cpu;
        int i;
 
-       hotcpu_notifier(workqueue_cpu_callback, CPU_PRI_WORKQUEUE);
+       cpu_notifier(workqueue_cpu_callback, CPU_PRI_WORKQUEUE);
 
        /* initialize gcwqs */
        for_each_gcwq_cpu(cpu) {