[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20260208130648.79d3d2ea89a46a8625736fbc@kernel.org>
Date: Sun, 8 Feb 2026 13:06:48 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux trace kernel
<linux-trace-kernel@...r.kernel.org>, Masami Hiramatsu
<mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH v2] tracing: Clean up use of trace_create_maxlat_file()
On Fri, 6 Feb 2026 23:04:10 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> From: Steven Rostedt <rostedt@...dmis.org>
>
> In trace.c, the function trace_create_maxlat_file() is defined behind the
> #ifdef CONFIG_TRACER_MAX_TRACE block. The #else part defines it as:
>
> #define trace_create_maxlat_file(tr, d_tracer) \
> trace_create_file("tracing_max_latency", TRACE_MODE_WRITE, \
> d_tracer, tr, &tracing_max_lat_fops)
>
> But the one place that it it used has:
>
> #ifdef CONFIG_TRACER_MAX_TRACE
> trace_create_maxlat_file(tr, d_tracer);
> #endif
>
> Which is pointless.
>
> Define trace_create_maxlat_file() when CONFIG_TRACER_MAX_TRACE is not
> defined as:
>
> static inline void trace_create_maxlat_file(struct trace_array *tr,
> struct dentry *d_tracer) { }
>
> And remove the #ifdef's from the code.
>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Thanks,
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>
> ---
> Changes since v1: https://patch.msgid.link/20260206121242.6cb1934d@gandalf.local.home
>
> - Fix stub function missing from !CONFIG_TRACER_MAX_TRACE
>
> kernel/trace/trace.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 6815df23e5a3..b59c237f463c 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1969,11 +1969,8 @@ void latency_fsnotify(struct trace_array *tr)
> }
>
> #else /* !LATENCY_FS_NOTIFY */
> -
> -#define trace_create_maxlat_file(tr, d_tracer) \
> - trace_create_file("tracing_max_latency", TRACE_MODE_WRITE, \
> - d_tracer, tr, &tracing_max_lat_fops)
> -
> +static inline void trace_create_maxlat_file(struct trace_array *tr,
> + struct dentry *d_tracer) { }
> #endif
>
> /*
> @@ -2109,7 +2106,9 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
> __update_max_tr(tr, tsk, cpu);
> arch_spin_unlock(&tr->max_lock);
> }
> -
> +#else
> +static inline void trace_create_maxlat_file(struct trace_array *tr,
> + struct dentry *d_tracer) { }
> #endif /* CONFIG_TRACER_MAX_TRACE */
>
> struct pipe_wait {
> @@ -10684,9 +10683,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
>
> create_trace_options_dir(tr);
>
> -#ifdef CONFIG_TRACER_MAX_TRACE
> trace_create_maxlat_file(tr, d_tracer);
> -#endif
>
> if (ftrace_create_function_files(tr, d_tracer))
> MEM_FAIL(1, "Could not allocate function filter files");
> --
> 2.51.0
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists