Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+3 -13
+3 -13
kernel/trace/trace_functions.c
··· 209 209 struct ftrace_ops *op, struct ftrace_regs *fregs) 210 210 { 211 211 struct trace_array *tr = op->private; 212 - struct trace_array_cpu *data; 213 212 unsigned int trace_ctx; 214 213 int bit; 215 214 ··· 223 224 224 225 trace_ctx = tracing_gen_ctx_dec(); 225 226 226 - data = this_cpu_ptr(tr->array_buffer.data); 227 - if (!atomic_read(&data->disabled)) 228 - trace_function(tr, ip, parent_ip, trace_ctx, NULL); 227 + trace_function(tr, ip, parent_ip, trace_ctx, NULL); 229 228 230 229 ftrace_test_recursion_unlock(bit); 231 230 } ··· 233 236 struct ftrace_ops *op, struct ftrace_regs *fregs) 234 237 { 235 238 struct trace_array *tr = op->private; 236 - struct trace_array_cpu *data; 237 239 unsigned int trace_ctx; 238 240 int bit; 239 - int cpu; 240 241 241 242 if (unlikely(!tr->function_enabled)) 242 243 return; ··· 245 250 246 251 trace_ctx = tracing_gen_ctx(); 247 252 248 - cpu = smp_processor_id(); 249 - data = per_cpu_ptr(tr->array_buffer.data, cpu); 250 - if (!atomic_read(&data->disabled)) 251 - trace_function(tr, ip, parent_ip, trace_ctx, fregs); 253 + trace_function(tr, ip, parent_ip, trace_ctx, fregs); 252 254 253 255 ftrace_test_recursion_unlock(bit); 254 256 } ··· 344 352 { 345 353 struct trace_func_repeats *last_info; 346 354 struct trace_array *tr = op->private; 347 - struct trace_array_cpu *data; 348 355 unsigned int trace_ctx; 349 356 int bit; 350 357 ··· 355 364 return; 356 365 357 366 parent_ip = function_get_true_parent_ip(parent_ip, fregs); 358 - data = this_cpu_ptr(tr->array_buffer.data); 359 - if (atomic_read(&data->disabled)) 367 + if (!tracer_tracing_is_on(tr)) 360 368 goto out; 361 369 362 370 /*