public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Michael Jeanson <mjeanson@efficios.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	bpf@vger.kernel.org, Joel Fernandes <joel@joelfernandes.org>,
	Jordan Rife <jrife@google.com>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] tracing: Use guard() rather than scoped_guard()
Date: Mon, 25 Nov 2024 15:26:56 +0100	[thread overview]
Message-ID: <20241125142656.GH38837@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241125142514.2897143-1-mathieu.desnoyers@efficios.com>

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.

      reply	other threads:[~2024-11-25 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 14:25 [RFC PATCH 1/1] tracing: Use guard() rather than scoped_guard() Mathieu Desnoyers
2024-11-25 14:26 ` Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125142656.GH38837@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=jrife@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjeanson@efficios.com \
    --cc=namhyung@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox