* [PATCH 2/3] tracing/function-graph-tracer: turn tracing_selftest_running into an int
@ 2008-12-06 2:41 Frederic Weisbecker
2008-12-08 14:15 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Frederic Weisbecker @ 2008-12-06 2:41 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Steven Rostedt, Linux Kernel
Impact: cleanups
Apply some suggestions of Steven Rostedt:
_turn tracing_selftest_running into a simple int (no need of an atomic_t)
_set it __read_mostly
_fix a comment style
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7a93c66..1cc0ebf 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -44,13 +44,14 @@
unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX;
unsigned long __read_mostly tracing_thresh;
-/* We need to change this state when a selftest is running.
+/*
+ * We need to change this state when a selftest is running.
* A selftest will lurk into the ring-buffer to count the
* entries inserted during the selftest although some concurrent
* insertions into the ring-buffer such as ftrace_printk could occurred
* at the same time, giving false positive or negative results.
*/
-static atomic_t tracing_selftest_running = ATOMIC_INIT(0);
+static bool __read_mostly tracing_selftest_running;
/* For tracers that don't implement custom flags */
static struct tracer_opt dummy_tracer_opt[] = {
@@ -574,6 +575,8 @@ int register_tracer(struct tracer *type)
unlock_kernel();
mutex_lock(&trace_types_lock);
+ tracing_selftest_running = true;
+
for (t = trace_types; t; t = t->next) {
if (strcmp(type->name, t->name) == 0) {
/* already found */
@@ -598,7 +601,6 @@ int register_tracer(struct tracer *type)
struct trace_array *tr = &global_trace;
int i;
- atomic_set(&tracing_selftest_running, 1);
/*
* Run a selftest on this tracer.
* Here we reset the trace buffer, and set the current
@@ -613,7 +615,6 @@ int register_tracer(struct tracer *type)
/* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name);
ret = type->selftest(type, tr);
- atomic_set(&tracing_selftest_running, 0);
/* the test is responsible for resetting too */
current_trace = saved_tracer;
if (ret) {
@@ -635,6 +636,7 @@ int register_tracer(struct tracer *type)
max_tracer_type_len = len;
out:
+ tracing_selftest_running = false;
mutex_unlock(&trace_types_lock);
lock_kernel();
@@ -3605,7 +3607,7 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
unsigned long flags, irq_flags;
int cpu, len = 0, size, pc;
- if (tracing_disabled || atomic_read(&tracing_selftest_running))
+ if (tracing_disabled || tracing_selftest_running)
return 0;
pc = preempt_count();
--
1.5.6.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/3] tracing/function-graph-tracer: turn tracing_selftest_running into an int
2008-12-06 2:41 [PATCH 2/3] tracing/function-graph-tracer: turn tracing_selftest_running into an int Frederic Weisbecker
@ 2008-12-08 14:15 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-12-08 14:15 UTC (permalink / raw)
To: Frederic Weisbecker; +Cc: Steven Rostedt, Linux Kernel
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> Impact: cleanups
>
> Apply some suggestions of Steven Rostedt:
>
> _turn tracing_selftest_running into a simple int (no need of an atomic_t)
> _set it __read_mostly
> _fix a comment style
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
applied to tip/tracing/function-graph-tracer, thanks Frederic!
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-08 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-06 2:41 [PATCH 2/3] tracing/function-graph-tracer: turn tracing_selftest_running into an int Frederic Weisbecker
2008-12-08 14:15 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox