Skip to contentSkip to conversation

trace: Remove get/put_cpu() from function_trace_init

PATCH In review Qiujun Huang 2 participants 2 messages Dec 30, 2020 – Jan 12, 2021 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 trace: Remove get/put_cpu() from function_trace_init

Since commit b6f11df26fdc ("trace: Call tracing_reset_online_cpus before tracer->init()"), get/put_cpu() are not needed anymore.
We can use raw_smp_processor_id() instead.

---
v2:
Use raw_smp_processor_id() instead of smp_processor_id()

---
 kernel/trace/trace_functions.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/trace/trace_functions.c +1 -2
index c5095dd28e20..f67aec5bb771 100644
@@ -106,8 +106,7 @@ static int function_trace_init(struct trace_array *tr)
 
 	ftrace_init_array_ops(tr, func);
 
-	tr->array_buffer.cpu = get_cpu();
-	put_cpu();
+	tr->array_buffer.cpu = raw_smp_processor_id();
 
 	tracing_start_cmdline_record();
 	tracing_start_function_trace(tr);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 3 lines · On Wed, 30 Dec 2020 22:05:21 +0800 Qiujun Huang <[email protected]> wrote:

Since commit b6f11df26fdc ("trace: Call tracing_reset_online_cpus before tracer->init()"), get/put_cpu() are not needed anymore.
We can use raw_smp_processor_id() instead.

I added both your patches (this one and the trace_ignore_this_task() kernel-doc fix to my queue.

Thanks!

-- Steve

Quoted 23 lines

---
v2:
Use raw_smp_processor_id() instead of smp_processor_id()

---
 kernel/trace/trace_functions.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/trace/trace_functions.c +1 -2
index c5095dd28e20..f67aec5bb771 100644
@@ -106,8 +106,7 @@ static int function_trace_init(struct trace_array *tr)
 
 	ftrace_init_array_ops(tr, func);
 
-	tr->array_buffer.cpu = get_cpu();
-	put_cpu();
+	tr->array_buffer.cpu = raw_smp_processor_id();
 
 	tracing_start_cmdline_record();
 	tracing_start_function_trace(tr);