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>,
Vincent Donnefort <vdonnefort@google.com>
Subject: Re: [PATCH] ring-buffer: Update pages_touched to reflect persistent buffer content
Date: Sun, 16 Feb 2025 00:17:55 +0900 [thread overview]
Message-ID: <20250216001755.b5e1f1ac00bef0b46dec74f4@kernel.org> (raw)
In-Reply-To: <20250214123512.0631436e@gandalf.local.home>
On Fri, 14 Feb 2025 12:35:12 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> The pages_touched field represents the number of subbuffers in the ring
> buffer that have content that can be read. This is used in accounting of
> "dirty_pages" and "buffer_percent" to allow the user to wait for the
> buffer to be filled to a certain amount before it reads the buffer in
> blocking mode.
>
> The persistent buffer never updated this value so it was set to zero, and
> this accounting would take it as it had no content. This would cause user
> space to wait for content even though there's enough content in the ring
> buffer that satisfies the buffer_percent.
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks,
>
> Cc: stable@vger.kernel.org
> Fixes: 5f3b6e839f3ce ("ring-buffer: Validate boot range memory events")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> kernel/trace/ring_buffer.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 0419d41a2060..bb6089c2951e 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1850,6 +1850,11 @@ static void rb_meta_validate_events(struct ring_buffer_per_cpu *cpu_buffer)
> cpu_buffer->cpu);
> goto invalid;
> }
> +
> + /* If the buffer has content, update pages_touched */
> + if (ret)
> + local_inc(&cpu_buffer->pages_touched);
> +
> entries += ret;
> entry_bytes += local_read(&head_page->page->commit);
> local_set(&cpu_buffer->head_page->entries, ret);
> --
> 2.47.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2025-02-15 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 17:35 Steven Rostedt
2025-02-15 15:17 ` 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=20250216001755.b5e1f1ac00bef0b46dec74f4@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 \
--cc=vdonnefort@google.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
all inboxes | Powered by JetHome®