Skip to content

Commit c638ebd

Browse files
committed
ftrace: Do not bother checking per CPU "disabled" flag
The per CPU "disabled" value was the original way to disable tracing when the tracing subsystem was first created. Today, the ring buffer infrastructure has its own way to disable tracing. In fact, things have changed so much since 2008 that many things ignore the disable flag. There's no reason for the function tracer to check it, if tracing is disabled, the ring buffer will not record the event anyway. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/20250505212234.868972758@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 6936298 commit c638ebd

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

kernel/trace/trace_functions.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
209209
struct ftrace_ops *op, struct ftrace_regs *fregs)
210210
{
211211
struct trace_array *tr = op->private;
212-
struct trace_array_cpu *data;
213212
unsigned int trace_ctx;
214213
int bit;
215214

@@ -224,9 +223,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
224223

225224
trace_ctx = tracing_gen_ctx_dec();
226225

227-
data = this_cpu_ptr(tr->array_buffer.data);
228-
if (!atomic_read(&data->disabled))
229-
trace_function(tr, ip, parent_ip, trace_ctx, NULL);
226+
trace_function(tr, ip, parent_ip, trace_ctx, NULL);
230227

231228
ftrace_test_recursion_unlock(bit);
232229
}
@@ -236,10 +233,8 @@ function_args_trace_call(unsigned long ip, unsigned long parent_ip,
236233
struct ftrace_ops *op, struct ftrace_regs *fregs)
237234
{
238235
struct trace_array *tr = op->private;
239-
struct trace_array_cpu *data;
240236
unsigned int trace_ctx;
241237
int bit;
242-
int cpu;
243238

244239
if (unlikely(!tr->function_enabled))
245240
return;
@@ -250,10 +245,7 @@ function_args_trace_call(unsigned long ip, unsigned long parent_ip,
250245

251246
trace_ctx = tracing_gen_ctx();
252247

253-
cpu = smp_processor_id();
254-
data = per_cpu_ptr(tr->array_buffer.data, cpu);
255-
if (!atomic_read(&data->disabled))
256-
trace_function(tr, ip, parent_ip, trace_ctx, fregs);
248+
trace_function(tr, ip, parent_ip, trace_ctx, fregs);
257249

258250
ftrace_test_recursion_unlock(bit);
259251
}
@@ -352,7 +344,6 @@ function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
352344
{
353345
struct trace_func_repeats *last_info;
354346
struct trace_array *tr = op->private;
355-
struct trace_array_cpu *data;
356347
unsigned int trace_ctx;
357348
int bit;
358349

@@ -364,8 +355,7 @@ function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
364355
return;
365356

366357
parent_ip = function_get_true_parent_ip(parent_ip, fregs);
367-
data = this_cpu_ptr(tr->array_buffer.data);
368-
if (atomic_read(&data->disabled))
358+
if (!tracer_tracing_is_on(tr))
369359
goto out;
370360

371361
/*

0 commit comments

Comments
 (0)