diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-10-31 08:28:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-04 11:14:07 -0500 |
commit | efade6e7821c4219818e9da08f9315dfa617048b (patch) | |
tree | 822e2cc2491d38f082d05a015758263f9bb194b3 /kernel | |
parent | d7ad44b697c9d13e445ddc7d16f736fbac333249 (diff) |
tracing/ftrace: types and naming corrections for sched tracer
Impact: cleanup
This patch applies some corrections suggested by Steven Rostedt.
Change the type of shed_ref into int since it is used
into a Mutex, we don't need it anymore as an atomic
variable in the sched_switch tracer.
Also change the name of the register mutex.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 9d7bdac331dd..969953bf678f 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -16,8 +16,8 @@ | |||
16 | 16 | ||
17 | static struct trace_array *ctx_trace; | 17 | static struct trace_array *ctx_trace; |
18 | static int __read_mostly tracer_enabled; | 18 | static int __read_mostly tracer_enabled; |
19 | static atomic_t sched_ref; | 19 | static int sched_ref; |
20 | static DEFINE_MUTEX(tracepoint_mutex); | 20 | static DEFINE_MUTEX(sched_register_mutex); |
21 | 21 | ||
22 | static void | 22 | static void |
23 | probe_sched_switch(struct rq *__rq, struct task_struct *prev, | 23 | probe_sched_switch(struct rq *__rq, struct task_struct *prev, |
@@ -28,7 +28,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev, | |||
28 | int cpu; | 28 | int cpu; |
29 | int pc; | 29 | int pc; |
30 | 30 | ||
31 | if (!atomic_read(&sched_ref)) | 31 | if (!sched_ref) |
32 | return; | 32 | return; |
33 | 33 | ||
34 | tracing_record_cmdline(prev); | 34 | tracing_record_cmdline(prev); |
@@ -124,26 +124,22 @@ static void tracing_sched_unregister(void) | |||
124 | 124 | ||
125 | static void tracing_start_sched_switch(void) | 125 | static void tracing_start_sched_switch(void) |
126 | { | 126 | { |
127 | long ref; | 127 | mutex_lock(&sched_register_mutex); |
128 | 128 | if (!(sched_ref++)) { | |
129 | mutex_lock(&tracepoint_mutex); | 129 | tracer_enabled = 1; |
130 | tracer_enabled = 1; | ||
131 | ref = atomic_inc_return(&sched_ref); | ||
132 | if (ref == 1) | ||
133 | tracing_sched_register(); | 130 | tracing_sched_register(); |
134 | mutex_unlock(&tracepoint_mutex); | 131 | } |
132 | mutex_unlock(&sched_register_mutex); | ||
135 | } | 133 | } |
136 | 134 | ||
137 | static void tracing_stop_sched_switch(void) | 135 | static void tracing_stop_sched_switch(void) |
138 | { | 136 | { |
139 | long ref; | 137 | mutex_lock(&sched_register_mutex); |
140 | 138 | if (!(--sched_ref)) { | |
141 | mutex_lock(&tracepoint_mutex); | ||
142 | tracer_enabled = 0; | ||
143 | ref = atomic_dec_and_test(&sched_ref); | ||
144 | if (ref) | ||
145 | tracing_sched_unregister(); | 139 | tracing_sched_unregister(); |
146 | mutex_unlock(&tracepoint_mutex); | 140 | tracer_enabled = 0; |
141 | } | ||
142 | mutex_unlock(&sched_register_mutex); | ||
147 | } | 143 | } |
148 | 144 | ||
149 | void tracing_start_cmdline_record(void) | 145 | void tracing_start_cmdline_record(void) |