[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241125142656.GH38837@noisy.programming.kicks-ass.net>
Date: Mon, 25 Nov 2024 15:26:56 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Michael Jeanson <mjeanson@...icios.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Yonghong Song <yhs@...com>,
"Paul E . McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Andrii Nakryiko <andrii.nakryiko@...il.com>, bpf@...r.kernel.org,
Joel Fernandes <joel@...lfernandes.org>,
Jordan Rife <jrife@...gle.com>, linux-trace-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/1] tracing: Use guard() rather than scoped_guard()
On Mon, Nov 25, 2024 at 09:25:14AM -0500, Mathieu Desnoyers wrote:
> Using scoped_guard() in the implementation of trace_##name() adds an
> unnecessary level of indentation.
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index b2633a72e871..e398f6e43f61 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -259,8 +259,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> { \
> if (static_branch_unlikely(&__tracepoint_##name.key)) { \
> if (cond) { \
> - scoped_guard(preempt_notrace) \
> - __DO_TRACE_CALL(name, TP_ARGS(args)); \
> + guard(preempt_notrace)(); \
> + __DO_TRACE_CALL(name, TP_ARGS(args)); \
> } \
> } \
> if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
> @@ -275,8 +275,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> { \
> might_fault(); \
> if (static_branch_unlikely(&__tracepoint_##name.key)) { \
> - scoped_guard(rcu_tasks_trace) \
> - __DO_TRACE_CALL(name, TP_ARGS(args)); \
> + guard(rcu_tasks_trace)(); \
> + __DO_TRACE_CALL(name, TP_ARGS(args)); \
> } \
> if (IS_ENABLED(CONFIG_LOCKDEP)) { \
> WARN_ONCE(!rcu_is_watching(), \
Yeah, that also works.
Powered by blists - more mailing lists