tracing: stop comm recording on tracing off
authorSteven Rostedt <srostedt@redhat.com>
Tue, 17 Mar 2009 01:57:17 +0000 (21:57 -0400)
committerSteven Rostedt <srostedt@redhat.com>
Tue, 17 Mar 2009 03:31:15 +0000 (23:31 -0400)
Impact: fix for losing comms in trace

The command lines of tasks are cached at sched switch to not need
to record them at every trace point.  Disabling the tracing on stops
the recording of traces, but does not stop the caching of command lines.
When the tracing is off the cache may overflow and cause the tracing
to show incorrect tasks matching the PIDs.

This patch disables prevents updates to the comm cache when the ring buffer
is off.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
kernel/trace/trace.c

index 2796bd2b17e4c4ad7e928691b4ca42c80cfd42ea..8f89690230e6516cbca2628fd5d88e99070c5df3 100644 (file)
@@ -797,7 +797,7 @@ void trace_find_cmdline(int pid, char comm[])
 
 void tracing_record_cmdline(struct task_struct *tsk)
 {
-       if (atomic_read(&trace_record_cmdline_disabled))
+       if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
                return;
 
        trace_save_cmdline(tsk);