tracing: do not update tracing_max_latency when tracer is stopped
authorCarsten Emde <Carsten.Emde@osadl.org>
Sat, 12 Sep 2009 23:43:07 +0000 (01:43 +0200)
committerSteven Rostedt <rostedt@goodmis.org>
Sun, 13 Sep 2009 01:45:17 +0000 (21:45 -0400)
The state of the function pair tracing_stop()/tracing_start() is
correctly considered when tracer data are updated. However, the global
and externally accessible variable tracing_max_latency is always updated
- even when tracing is stopped.

The update should only occur, if tracing was not stopped.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_irqsoff.c
kernel/trace/trace_sched_wakeup.c

index 45c3f0352d787de6169c6624b8a3b65a5ed6d011..ef82a7fabf3b285825bad541adb7d98bc12929cc 100644 (file)
@@ -825,6 +825,11 @@ static void trace_init_cmdlines(void)
        cmdline_idx = 0;
 }
 
+int is_tracing_stopped(void)
+{
+       return trace_stop_count;
+}
+
 /**
  * ftrace_off_permanent - disable all ftrace code permanently
  *
index 28247cecd955de997862e9d973b1a10fe3a2dd99..4ad4e1ddcb9b829d2faf9fdf96b556707002e57c 100644 (file)
@@ -461,6 +461,7 @@ void tracing_stop_sched_switch_record(void);
 void tracing_start_sched_switch_record(void);
 int register_tracer(struct tracer *type);
 void unregister_tracer(struct tracer *type);
+int is_tracing_stopped(void);
 
 extern unsigned long nsecs_to_usecs(unsigned long nsecs);
 
index 06f8ea9e4b9d907564ce257ad9a47a4648c1fa87..3aa7eaa2114ce2abc5ae411725c7cfaa71fb137a 100644 (file)
@@ -157,8 +157,10 @@ check_critical_timing(struct trace_array *tr,
 
        data->critical_end = parent_ip;
 
-       tracing_max_latency = delta;
-       update_max_tr_single(tr, current, cpu);
+       if (likely(!is_tracing_stopped())) {
+               tracing_max_latency = delta;
+               update_max_tr_single(tr, current, cpu);
+       }
 
        max_sequence++;
 
index 6e1529bc6172c50cebff98caeb6dbf9d4d2a0794..26185d727676b0620496a9eb5a4832e9c3fdbd01 100644 (file)
@@ -162,8 +162,10 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
        if (!report_latency(delta))
                goto out_unlock;
 
-       tracing_max_latency = delta;
-       update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu);
+       if (likely(!is_tracing_stopped())) {
+               tracing_max_latency = delta;
+               update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu);
+       }
 
 out_unlock:
        __wakeup_reset(wakeup_trace);