2009-01-28 15:02:39

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH] trace: Use tracing_reset_online_cpus in more places

Impact: cleanup

Cc: Fr?d?ric Weisbecker <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index ca017e0..1284145 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -133,11 +133,7 @@ static void stop_branch_trace(struct trace_array *tr)

static int branch_trace_init(struct trace_array *tr)
{
- int cpu;
-
- for_each_online_cpu(cpu)
- tracing_reset(tr, cpu);
-
+ tracing_reset_online_cpus(tr);
start_branch_trace(tr);
return 0;
}
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 66fc7b8..c97594d 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -52,15 +52,11 @@ static struct tracer_flags tracer_flags = {

static int graph_trace_init(struct trace_array *tr)
{
- int cpu, ret;
-
- for_each_online_cpu(cpu)
- tracing_reset(tr, cpu);
-
- ret = register_ftrace_graph(&trace_graph_return,
+ int ret = register_ftrace_graph(&trace_graph_return,
&trace_graph_entry);
if (ret)
return ret;
+ tracing_reset_online_cpus(tr);
tracing_start_cmdline_record();

return 0;
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c
index b9767ac..087b6cb 100644
--- a/kernel/trace/trace_nop.c
+++ b/kernel/trace/trace_nop.c
@@ -47,12 +47,8 @@ static void stop_nop_trace(struct trace_array *tr)

static int nop_trace_init(struct trace_array *tr)
{
- int cpu;
ctx_trace = tr;
-
- for_each_online_cpu(cpu)
- tracing_reset(tr, cpu);
-
+ tracing_reset_online_cpus(tr);
start_nop_trace(tr);
return 0;
}


2009-01-28 15:06:18

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH] trace: Use tracing_reset_online_cpus in more places

2009/1/28 Arnaldo Carvalho de Melo <[email protected]>:
> Impact: cleanup
>
> Cc: Fr?d?ric Weisbecker <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
> index ca017e0..1284145 100644
> --- a/kernel/trace/trace_branch.c
> +++ b/kernel/trace/trace_branch.c
> @@ -133,11 +133,7 @@ static void stop_branch_trace(struct trace_array *tr)
>
> static int branch_trace_init(struct trace_array *tr)
> {
> - int cpu;
> -
> - for_each_online_cpu(cpu)
> - tracing_reset(tr, cpu);
> -
> + tracing_reset_online_cpus(tr);
> start_branch_trace(tr);
> return 0;
> }
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 66fc7b8..c97594d 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -52,15 +52,11 @@ static struct tracer_flags tracer_flags = {
>
> static int graph_trace_init(struct trace_array *tr)
> {
> - int cpu, ret;
> -
> - for_each_online_cpu(cpu)
> - tracing_reset(tr, cpu);
> -
> - ret = register_ftrace_graph(&trace_graph_return,
> + int ret = register_ftrace_graph(&trace_graph_return,
> &trace_graph_entry);
> if (ret)
> return ret;
> + tracing_reset_online_cpus(tr);
> tracing_start_cmdline_record();
>
> return 0;
> diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c
> index b9767ac..087b6cb 100644
> --- a/kernel/trace/trace_nop.c
> +++ b/kernel/trace/trace_nop.c
> @@ -47,12 +47,8 @@ static void stop_nop_trace(struct trace_array *tr)
>
> static int nop_trace_init(struct trace_array *tr)
> {
> - int cpu;
> ctx_trace = tr;
> -
> - for_each_online_cpu(cpu)
> - tracing_reset(tr, cpu);
> -
> + tracing_reset_online_cpus(tr);
> start_nop_trace(tr);
> return 0;
> }
>

Thanks :-)

Acked-by: Frederic Weisbecker <[email protected]>

2009-01-29 13:30:00

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] trace: Use tracing_reset_online_cpus in more places


* Fr?d?ric Weisbecker <[email protected]> wrote:

> 2009/1/28 Arnaldo Carvalho de Melo <[email protected]>:
> > Impact: cleanup
> >
> > Cc: Fr?d?ric Weisbecker <[email protected]>
> > Cc: Steven Rostedt <[email protected]>
> > Cc: Ingo Molnar <[email protected]>
> > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
> >
> > diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
> > index ca017e0..1284145 100644
> > --- a/kernel/trace/trace_branch.c
> > +++ b/kernel/trace/trace_branch.c
> > @@ -133,11 +133,7 @@ static void stop_branch_trace(struct trace_array *tr)
> >
> > static int branch_trace_init(struct trace_array *tr)
> > {
> > - int cpu;
> > -
> > - for_each_online_cpu(cpu)
> > - tracing_reset(tr, cpu);
> > -
> > + tracing_reset_online_cpus(tr);
> > start_branch_trace(tr);
> > return 0;
> > }
> > diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> > index 66fc7b8..c97594d 100644
> > --- a/kernel/trace/trace_functions_graph.c
> > +++ b/kernel/trace/trace_functions_graph.c
> > @@ -52,15 +52,11 @@ static struct tracer_flags tracer_flags = {
> >
> > static int graph_trace_init(struct trace_array *tr)
> > {
> > - int cpu, ret;
> > -
> > - for_each_online_cpu(cpu)
> > - tracing_reset(tr, cpu);
> > -
> > - ret = register_ftrace_graph(&trace_graph_return,
> > + int ret = register_ftrace_graph(&trace_graph_return,
> > &trace_graph_entry);
> > if (ret)
> > return ret;
> > + tracing_reset_online_cpus(tr);
> > tracing_start_cmdline_record();
> >
> > return 0;
> > diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c
> > index b9767ac..087b6cb 100644
> > --- a/kernel/trace/trace_nop.c
> > +++ b/kernel/trace/trace_nop.c
> > @@ -47,12 +47,8 @@ static void stop_nop_trace(struct trace_array *tr)
> >
> > static int nop_trace_init(struct trace_array *tr)
> > {
> > - int cpu;
> > ctx_trace = tr;
> > -
> > - for_each_online_cpu(cpu)
> > - tracing_reset(tr, cpu);
> > -
> > + tracing_reset_online_cpus(tr);
> > start_nop_trace(tr);
> > return 0;
> > }
> >
>
> Thanks :-)
>
> Acked-by: Frederic Weisbecker <[email protected]>

Applied to tip/tracing/ftrace (with your Ack added), thanks guys!

Ingo