diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 19:59:53 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 23:10:45 -0400 |
commit | 5fec6ddcb43a91aa9a254c8ecf174c803de6f07e (patch) | |
tree | 6c8e3c0d719022e7c82d87894c9eb28492035aa5 | |
parent | 97e7e4f391cac2b00417b581b432533d245d4fd0 (diff) |
tracing: make sched_switch stop/start light weight
The stopping and starting of a tracer should be light weight and
be able to be called in all contexts. The sched_switch grabbed
mutexes in the start/stop functions. This patch changes it to a
simple variable, on/off.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 77132c2cf3d9..de35f200abd3 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -18,6 +18,7 @@ static struct trace_array *ctx_trace; | |||
18 | static int __read_mostly tracer_enabled; | 18 | static int __read_mostly tracer_enabled; |
19 | static int sched_ref; | 19 | static int sched_ref; |
20 | static DEFINE_MUTEX(sched_register_mutex); | 20 | static DEFINE_MUTEX(sched_register_mutex); |
21 | static int sched_stopped; | ||
21 | 22 | ||
22 | static void | 23 | static void |
23 | probe_sched_switch(struct rq *__rq, struct task_struct *prev, | 24 | probe_sched_switch(struct rq *__rq, struct task_struct *prev, |
@@ -28,7 +29,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev, | |||
28 | int cpu; | 29 | int cpu; |
29 | int pc; | 30 | int pc; |
30 | 31 | ||
31 | if (!sched_ref) | 32 | if (!sched_ref || sched_stopped) |
32 | return; | 33 | return; |
33 | 34 | ||
34 | tracing_record_cmdline(prev); | 35 | tracing_record_cmdline(prev); |
@@ -193,6 +194,7 @@ static void stop_sched_trace(struct trace_array *tr) | |||
193 | static int sched_switch_trace_init(struct trace_array *tr) | 194 | static int sched_switch_trace_init(struct trace_array *tr) |
194 | { | 195 | { |
195 | ctx_trace = tr; | 196 | ctx_trace = tr; |
197 | tracing_reset_online_cpus(tr); | ||
196 | tracing_start_sched_switch_record(); | 198 | tracing_start_sched_switch_record(); |
197 | return 0; | 199 | return 0; |
198 | } | 200 | } |
@@ -205,13 +207,12 @@ static void sched_switch_trace_reset(struct trace_array *tr) | |||
205 | 207 | ||
206 | static void sched_switch_trace_start(struct trace_array *tr) | 208 | static void sched_switch_trace_start(struct trace_array *tr) |
207 | { | 209 | { |
208 | tracing_reset_online_cpus(tr); | 210 | sched_stopped = 0; |
209 | tracing_start_sched_switch(); | ||
210 | } | 211 | } |
211 | 212 | ||
212 | static void sched_switch_trace_stop(struct trace_array *tr) | 213 | static void sched_switch_trace_stop(struct trace_array *tr) |
213 | { | 214 | { |
214 | tracing_stop_sched_switch(); | 215 | sched_stopped = 1; |
215 | } | 216 | } |
216 | 217 | ||
217 | static struct tracer sched_switch_trace __read_mostly = | 218 | static struct tracer sched_switch_trace __read_mostly = |