Skip to contentSkip to conversation

tracing/ftrace: Remove unused code in sched_switch tracer

PATCH RESEND In review Frederic Weisbecker 1 participant 2 messages Oct 31, 2008 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tracing/ftrace: Remove unused code in sched_switch tracer

When init_sched_switch_trace() is called, it has no reason to start the sched tracer if the sched_ref is not zero.

_ If this is non-zero, the tracer is already used, but we can register it to the tracing engine. There is already a security which avoid the tracer probes not to be resgistered twice.

_ If this is zero, this block will not be used.

---
 kernel/trace/trace_sched_switch.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
kernel/trace/trace_sched_switch.c +0 -8
index 59de514..96620c7 100644
@@ -203,14 +203,6 @@ static struct tracer sched_switch_trace __read_mostly =
 
 __init static int init_sched_switch_trace(void)
 {
-	int ret = 0;
-
-	if (atomic_read(&sched_ref))
-		ret = tracing_sched_register();
-	if (ret) {
-		pr_info("error registering scheduler trace\n");
-		return ret;
-	}
 	return register_tracer(&sched_switch_trace);
 }
 device_initcall(init_sched_switch_trace);
#1 lore raw

2008/10/31 Frederic Weisbecker <[email protected]>:

Quoted 24 lines

When init_sched_switch_trace() is called, it has no reason to start the sched tracer if the sched_ref is not zero.

_ If this is non-zero, the tracer is already used, but we can register it to the tracing engine. There is already a security which avoid the tracer probes not to be resgistered twice.

_ If this is zero, this block will not be used.

---
 kernel/trace/trace_sched_switch.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
kernel/trace/trace_sched_switch.c +0 -1
index 59de514..96620c7 100644
@@ -203,14 +203,6 @@ static struct tracer sched_switch_trace __read_mostly =
 
 __init static int init_sched_switch_trace(void)
 {
-       int ret = 0;

kernel/trace/trace_sched_switch.c static struct tracer sched_switch_trace __read_mostly = · line 208

Quoted 10 lines
kernel/trace/trace_sched_switch.c +0 -7
-
-       if (atomic_read(&sched_ref))
-               ret = tracing_sched_register();
-       if (ret) {
-               pr_info("error registering scheduler trace\n");
-               return ret;
-       }
       return register_tracer(&sched_switch_trace);
 }
 device_initcall(init_sched_switch_trace);

(depends on tracing/ftrace: Fix a race condition in sched_switch tracer)