]> err.no Git - linux-2.6/commitdiff
ftrace: move ftrace_special to trace.c
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 22 May 2008 04:22:18 +0000 (00:22 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 26 May 2008 20:51:09 +0000 (22:51 +0200)
Move the ftrace_special out of sched_switch to trace.c.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: pq@iki.fi
Cc: proski@gnu.org
Cc: sandmann@redhat.com
Cc: a.p.zijlstra@chello.nl
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/trace/trace.c
kernel/trace/trace_sched_switch.c

index 0567f51bbea4a4070876f3a2f59cfba11bdfb795..583fe24903d39c35240bc66f976dd4a1b156ad02 100644 (file)
@@ -941,6 +941,30 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
        trace_wake_up();
 }
 
+void
+ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
+{
+       struct trace_array *tr = &global_trace;
+       struct trace_array_cpu *data;
+       unsigned long flags;
+       long disabled;
+       int cpu;
+
+       if (tracing_disabled || current_trace == &no_tracer || !tr->ctrl)
+               return;
+
+       local_irq_save(flags);
+       cpu = raw_smp_processor_id();
+       data = tr->data[cpu];
+       disabled = atomic_inc_return(&data->disabled);
+
+       if (likely(disabled == 1))
+               __trace_special(tr, data, arg1, arg2, arg3);
+
+       atomic_dec(&data->disabled);
+       local_irq_restore(flags);
+}
+
 #ifdef CONFIG_FTRACE
 static void
 function_trace_call(unsigned long ip, unsigned long parent_ip)
@@ -2941,8 +2965,6 @@ __init static int tracer_alloc_buffers(void)
        int ret = -ENOMEM;
        int i;
 
-       global_trace.ctrl = tracer_enabled;
-
        /* TODO: make the number of buffers hot pluggable with CPUS */
        tracing_nr_buffers = num_possible_cpus();
        tracing_buffer_mask = cpu_possible_map;
@@ -3012,6 +3034,7 @@ __init static int tracer_alloc_buffers(void)
        current_trace = &no_tracer;
 
        /* All seems OK, enable tracing */
+       global_trace.ctrl = tracer_enabled;
        tracing_disabled = 0;
 
        return 0;
index d25ffa5eaf2b622be6b1409188a676388cb4617a..798ec0dc863c3e9e0541584c398a799304e91dfa 100644 (file)
@@ -125,30 +125,6 @@ wake_up_callback(void *probe_data, void *call_data,
        wakeup_func(probe_data, __rq, task, curr);
 }
 
-void
-ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
-{
-       struct trace_array *tr = ctx_trace;
-       struct trace_array_cpu *data;
-       unsigned long flags;
-       long disabled;
-       int cpu;
-
-       if (!tracer_enabled)
-               return;
-
-       local_irq_save(flags);
-       cpu = raw_smp_processor_id();
-       data = tr->data[cpu];
-       disabled = atomic_inc_return(&data->disabled);
-
-       if (likely(disabled == 1))
-               __trace_special(tr, data, arg1, arg2, arg3);
-
-       atomic_dec(&data->disabled);
-       local_irq_restore(flags);
-}
-
 static void sched_switch_reset(struct trace_array *tr)
 {
        int cpu;