if (!tracer_enabled)
return;
- tracing_record_cmdline(prev);
-
local_irq_save(flags);
cpu = raw_smp_processor_id();
data = tr->data[cpu];
disabled = atomic_inc_return(&data->disabled);
- if (likely(disabled == 1)) {
+ if (likely(disabled == 1))
tracing_sched_switch_trace(tr, data, prev, next, flags);
- if (trace_flags & TRACE_ITER_SCHED_TREE)
- ftrace_all_fair_tasks(__rq, tr, data);
- }
atomic_dec(&data->disabled);
local_irq_restore(flags);
data = tr->data[cpu];
disabled = atomic_inc_return(&data->disabled);
- if (likely(disabled == 1)) {
+ if (likely(disabled == 1))
tracing_sched_wakeup_trace(tr, data, wakee, curr, flags);
- if (trace_flags & TRACE_ITER_SCHED_TREE)
- ftrace_all_fair_tasks(__rq, tr, data);
- }
atomic_dec(&data->disabled);
local_irq_restore(flags);
ftrace_ctx_switch(void *__rq, struct task_struct *prev,
struct task_struct *next)
{
+ if (unlikely(atomic_read(&trace_record_cmdline_enabled)))
+ tracing_record_cmdline(prev);
+
/*
* If tracer_switch_func only points to the local
* switch func, it still needs the ptr passed to it.
static void start_sched_trace(struct trace_array *tr)
{
sched_switch_reset(tr);
+ atomic_inc(&trace_record_cmdline_enabled);
tracer_enabled = 1;
}
static void stop_sched_trace(struct trace_array *tr)
{
+ atomic_dec(&trace_record_cmdline_enabled);
tracer_enabled = 0;
}