Merge branches 'tracing/ftrace', 'tracing/function-graph-tracer' and 'tracing/urgent...
[linux-2.6.git] / kernel / trace / trace.c
index 1ca74c0..ea38652 100644 (file)
@@ -1209,6 +1209,12 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
        int cpu;
        int pc;
 
+       if (!ftrace_trace_task(current))
+               return 0;
+
+       if (!ftrace_graph_addr(trace->func))
+               return 0;
+
        local_irq_save(flags);
        cpu = raw_smp_processor_id();
        data = tr->data[cpu];
@@ -1217,6 +1223,9 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
                pc = preempt_count();
                __trace_graph_entry(tr, data, trace, flags, pc);
        }
+       /* Only do the atomic if it is not already set */
+       if (!test_tsk_trace_graph(current))
+               set_tsk_trace_graph(current);
        atomic_dec(&data->disabled);
        local_irq_restore(flags);
 
@@ -1240,6 +1249,8 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
                pc = preempt_count();
                __trace_graph_return(tr, data, trace, flags, pc);
        }
+       if (!trace->depth)
+               clear_tsk_trace_graph(current);
        atomic_dec(&data->disabled);
        local_irq_restore(flags);
 }