aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_sched_switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_sched_switch.c')
-rw-r--r--kernel/trace/trace_sched_switch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 5671db0e1827..a3376478fc2c 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -29,8 +29,6 @@ ctx_switch_func(void *__rq, struct task_struct *prev, struct task_struct *next)
29 if (!tracer_enabled) 29 if (!tracer_enabled)
30 return; 30 return;
31 31
32 tracing_record_cmdline(prev);
33
34 local_irq_save(flags); 32 local_irq_save(flags);
35 cpu = raw_smp_processor_id(); 33 cpu = raw_smp_processor_id();
36 data = tr->data[cpu]; 34 data = tr->data[cpu];
@@ -73,6 +71,9 @@ void
73ftrace_ctx_switch(void *__rq, struct task_struct *prev, 71ftrace_ctx_switch(void *__rq, struct task_struct *prev,
74 struct task_struct *next) 72 struct task_struct *next)
75{ 73{
74 if (unlikely(atomic_read(&trace_record_cmdline_enabled)))
75 tracing_record_cmdline(prev);
76
76 /* 77 /*
77 * If tracer_switch_func only points to the local 78 * If tracer_switch_func only points to the local
78 * switch func, it still needs the ptr passed to it. 79 * switch func, it still needs the ptr passed to it.
@@ -134,11 +135,13 @@ static void sched_switch_reset(struct trace_array *tr)
134static void start_sched_trace(struct trace_array *tr) 135static void start_sched_trace(struct trace_array *tr)
135{ 136{
136 sched_switch_reset(tr); 137 sched_switch_reset(tr);
138 atomic_inc(&trace_record_cmdline_enabled);
137 tracer_enabled = 1; 139 tracer_enabled = 1;
138} 140}
139 141
140static void stop_sched_trace(struct trace_array *tr) 142static void stop_sched_trace(struct trace_array *tr)
141{ 143{
144 atomic_dec(&trace_record_cmdline_enabled);
142 tracer_enabled = 0; 145 tracer_enabled = 0;
143} 146}
144 147