diff mbox series

[RFC,1/1] tracing: Use guard() rather than scoped_guard()

Message ID 20241125142514.2897143-1-mathieu.desnoyers@efficios.com (mailing list archive)
State Queued
Commit 2bd9b57d04df417f31ef54448477c212fcdd14fc
Headers show
Series [RFC,1/1] tracing: Use guard() rather than scoped_guard() | expand

Commit Message

Mathieu Desnoyers Nov. 25, 2024, 2:25 p.m. UTC
Using scoped_guard() in the implementation of trace_##name() adds an
unnecessary level of indentation.

[ This is based on the series "tracing: Remove conditional locking from
  tracepoint". ]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Michael Jeanson <mjeanson@efficios.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Jordan Rife <jrife@google.com>
Cc: linux-trace-kernel@vger.kernel.org
---
 include/linux/tracepoint.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Peter Zijlstra Nov. 25, 2024, 2:26 p.m. UTC | #1
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.
diff mbox series

Patch

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(),			\