summaryrefslogtreecommitdiff
path: root/kernel/trace/trace_sched_switch.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-10-04 10:01:00 +0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 12:39:20 +0400
commit3ea2e6d71aafe35b8aaf89ed711a283815acfae6 (patch)
treee4bae61f9bbe5ff7ccf6eac95416b98ebd4974a4 /kernel/trace/trace_sched_switch.c
parentbf41a158cacba6ca5fc6407a54e7ad8ce1567e2e (diff)
downloadlinux-3ea2e6d71aafe35b8aaf89ed711a283815acfae6.tar.xz
ftrace: make some tracers reentrant
Now that the ring buffer is reentrant, some of the ftrace tracers (sched_swich, debugging traces) can also be reentrant. Note: Never make the function tracer reentrant, that can cause recursion problems all over the kernel. The function tracer must disable reentrancy. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_sched_switch.c')
-rw-r--r--kernel/trace/trace_sched_switch.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index c7fa08a5b7f4..b8f56beb1a62 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -24,7 +24,6 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
{
struct trace_array_cpu *data;
unsigned long flags;
- long disabled;
int cpu;
int pc;
@@ -41,12 +40,10 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
local_irq_save(flags);
cpu = raw_smp_processor_id();
data = ctx_trace->data[cpu];
- disabled = atomic_inc_return(&data->disabled);
- if (likely(disabled == 1))
+ if (likely(!atomic_read(&data->disabled)))
tracing_sched_switch_trace(ctx_trace, data, prev, next, flags, pc);
- atomic_dec(&data->disabled);
local_irq_restore(flags);
}
@@ -55,7 +52,6 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
{
struct trace_array_cpu *data;
unsigned long flags;
- long disabled;
int cpu, pc;
if (!likely(tracer_enabled))
@@ -67,13 +63,11 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
local_irq_save(flags);
cpu = raw_smp_processor_id();
data = ctx_trace->data[cpu];
- disabled = atomic_inc_return(&data->disabled);
- if (likely(disabled == 1))
+ if (likely(!atomic_read(&data->disabled)))
tracing_sched_wakeup_trace(ctx_trace, data, wakee, current,
flags, pc);
- atomic_dec(&data->disabled);
local_irq_restore(flags);
}