From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] ring-buffer: Unify ring buffer minimum page calculations
Date: Mon, 07 Sep 2026 19:42:57 +0000 [thread overview]
Message-ID: <20260907194258.4E6E21F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907192643.42513-3-vdonnefort@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] A hardcoded minimum page limit was missed during refactoring in trace_rb_cpu_prepare().
--
commit 699b707360c7ac89e4a8f2b996c220e5cb22ea93
Author: Vincent Donnefort <vdonnefort@google.com>
ring-buffer: Unify ring buffer minimum page calculations
The commit introduces the RING_BUFFER_MIN_NR_PAGES macro to formalize the
requirement of having at least two pages in a ring buffer. It updates multiple
sites across the codebase to use this new unified calculation instead of
scattered hardcoded values.
> diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
> index 7a1a92f876503..a9401b8ebc721 100644
> --- a/include/linux/ring_buffer.h
> +++ b/include/linux/ring_buffer.h
> @@ -99,6 +99,13 @@ struct trace_buffer *__ring_buffer_alloc_range(unsigned long size, unsigned flag
>
> void *ring_buffer_meta_scratch(struct trace_buffer *buffer, unsigned int *size);
>
> +/*
> + * A minimum of 2 pages ensures we can always swap a page out of the ring
> + * buffer. This does not account for the reader page or any other page
> + * containing meta data used by static ring buffers.
> + */
> +#define RING_BUFFER_MIN_NR_PAGES 2UL
> +
[Severity: Low]
Was a hardcoded minimum page limit missed during this refactoring?
Looking at kernel/trace/ring_buffer.c:trace_rb_cpu_prepare(), when a newly
hotplugged CPU is brought online and detects varying subbuffer sizes across
existing CPUs (!nr_pages_same), it still uses a hardcoded fallback limit:
kernel/trace/ring_buffer.c:trace_rb_cpu_prepare() {
...
/* allocate minimum pages, user can later expand it */
if (!nr_pages_same)
nr_pages = 2;
...
}
Should this fallback allocation use the newly introduced
RING_BUFFER_MIN_NR_PAGES macro instead to avoid a maintenance hazard if the
minimum requirement changes in the future?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907192643.42513-1-vdonnefort@google.com?part=2
next prev parent reply other threads:[~2026-09-07 19:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 19:26 [PATCH v1 0/2] ring-buffer: Fix and unify size and page calculations Vincent Donnefort
2026-09-07 19:26 ` [PATCH v1 1/2] tracing/remotes: Account for ring buffer page header in size calculation Vincent Donnefort
2026-09-07 19:42 ` sashiko-bot
2026-09-09 22:13 ` Steven Rostedt
2026-09-11 14:32 ` Vincent Donnefort
2026-09-07 19:26 ` [PATCH v1 2/2] ring-buffer: Unify ring buffer minimum page calculations Vincent Donnefort
2026-09-07 19:42 ` sashiko-bot [this message]
2026-09-09 22:19 ` Steven Rostedt
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=20260907194258.4E6E21F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.