]> 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 da6c482944d7df998d3838061e49f6af5aceea71..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);
 
@@ -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) {