static int __read_mostly       tracer_enabled;
 static int                     sched_ref;
 static DEFINE_MUTEX(sched_register_mutex);
+static int                     sched_stopped;
 
 static void
 probe_sched_switch(struct rq *__rq, struct task_struct *prev,
        int cpu;
        int pc;
 
-       if (!sched_ref)
+       if (!sched_ref || sched_stopped)
                return;
 
        tracing_record_cmdline(prev);
 static int sched_switch_trace_init(struct trace_array *tr)
 {
        ctx_trace = tr;
+       tracing_reset_online_cpus(tr);
        tracing_start_sched_switch_record();
        return 0;
 }
 
 static void sched_switch_trace_start(struct trace_array *tr)
 {
-       tracing_reset_online_cpus(tr);
-       tracing_start_sched_switch();
+       sched_stopped = 0;
 }
 
 static void sched_switch_trace_stop(struct trace_array *tr)
 {
-       tracing_stop_sched_switch();
+       sched_stopped = 1;
 }
 
 static struct tracer sched_switch_trace __read_mostly =