]> Pileus Git - ~andy/linux/blobdiff - kernel/trace/trace.c
tracing: Schedule a delayed work to call wakeup()
[~andy/linux] / kernel / trace / trace.c
index ee9c921d7f21e4d0578e35032607e9bc542e219f..71777c8fe36b3691d3f074dba3da8a4e849cacb0 100644 (file)
@@ -343,26 +343,27 @@ unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
 static int trace_stop_count;
 static DEFINE_SPINLOCK(tracing_start_lock);
 
+static void wakeup_work_handler(struct work_struct *work)
+{
+       wake_up(&trace_wait);
+}
+
+static DECLARE_DELAYED_WORK(wakeup_work, wakeup_work_handler);
+
 /**
  * trace_wake_up - wake up tasks waiting for trace input
  *
- * Simply wakes up any task that is blocked on the trace_wait
- * queue. These is used with trace_poll for tasks polling the trace.
+ * Schedules a delayed work to wake up any task that is blocked on the
+ * trace_wait queue. These is used with trace_poll for tasks polling the
+ * trace.
  */
 void trace_wake_up(void)
 {
-       int cpu;
+       const unsigned long delay = msecs_to_jiffies(2);
 
        if (trace_flags & TRACE_ITER_BLOCK)
                return;
-       /*
-        * The runqueue_is_locked() can fail, but this is the best we
-        * have for now:
-        */
-       cpu = get_cpu();
-       if (!runqueue_is_locked(cpu))
-               wake_up(&trace_wait);
-       put_cpu();
+       schedule_delayed_work(&wakeup_work, delay);
 }
 
 static int __init set_buf_size(char *str)