From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] ring-buffer: Simplify reset_disabled_cpu_buffer() with use of guard()
Date: Wed, 28 May 2025 09:30:05 +0900 [thread overview]
Message-ID: <20250528093005.486a6fdbaae7976430680baf@kernel.org> (raw)
In-Reply-To: <20250527144623.77a9cc47@gandalf.local.home>
On Tue, 27 May 2025 14:46:23 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> Use guard(raw_spinlock_irqsave)() in reset_disabled_cpu_buffer() to
> simplify the locking.
>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> kernel/trace/ring_buffer.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 10a4b26929ae..0b21d64e90c8 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -6112,21 +6112,16 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
> /* Must have disabled the cpu buffer then done a synchronize_rcu */
> static void reset_disabled_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer)
> {
> - unsigned long flags;
> -
> - raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
> + guard(raw_spinlock_irqsave)(&cpu_buffer->reader_lock);
>
> if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing)))
> - goto out;
> + return;
>
> arch_spin_lock(&cpu_buffer->lock);
>
> rb_reset_cpu(cpu_buffer);
>
> arch_spin_unlock(&cpu_buffer->lock);
> -
> - out:
> - raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
> }
>
> /**
> --
> 2.47.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2025-05-28 0:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 18:46 [PATCH] ring-buffer: Simplify reset_disabled_cpu_buffer() with use of guard() Steven Rostedt
2025-05-28 0:30 ` Masami Hiramatsu [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=20250528093005.486a6fdbaae7976430680baf@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
/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;
as well as URLs for NNTP newsgroup(s).