From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v3 0/3] tracing: Clean up the snapshot and max tracer code
Date: Sun, 08 Feb 2026 13:38:32 -0500 [thread overview]
Message-ID: <20260208183832.118080581@kernel.org> (raw)
When tracing first was added it had latency tracers that used a separate
snapshot buffer to swap the current buffer being written to with a static
buffer that is only read. This later became a feature that user space could
use by attaching to the latency tracer snapshot buffer. But the buffer was
named max_buffer which is not what it is used for in all cases.
Rename the max_buffer name to snapshot_buffer.
The "use_max_tr" field of the tracer structure is only defined when
CONFIG_TRACER_MAX_TRACE is defined. To get rid of some of the #ifdefs in the
code around accesses of that field, use a helper function
tracer_uses_snapshot() that access the field when the config is defined, or
returns false if not.
Finally, since the latency tracers use the snapshot buffer and snapshot
buffers do not need latency tracers, have the TRACER_MAX_TRACE config select
TRACE_SNAPSHOT config and not the other way around. Also clean up the code
to properly protect the max tracer references and the snapshot references.
Changes since v2: https://lore.kernel.org/all/20260208040156.005531619@kernel.org/
- Fix tracing_set_tracer() when CONFIG_TRACER_SNAPSHOT is not enabled.
Seems that some fields that are only available with that config were
still exposed, and the local variable used was still hidden.
(kernel test robot)
- Fix trace_create_maxlat_file() declaration when CONFIG_TRACER_SNAPSHOT
is not defined.
Changes since v1: https://lore.kernel.org/linux-trace-kernel/20260206193741.767171392@kernel.org/
- This separates the updates to snapshot buffer and max tracers from
the last series. It was a rewrite.
Steven Rostedt (3):
tracing: Rename trace_array field max_buffer to snapshot_buffer
tracing: Add tracer_uses_snapshot() helper to remove #ifdefs
tracing: Better separate SNAPSHOT and MAX_TRACE options
----
kernel/trace/Kconfig | 8 +-
kernel/trace/trace.c | 192 +++++++++++++++++++-----------------------
kernel/trace/trace.h | 44 +++++++---
kernel/trace/trace_selftest.c | 10 +--
4 files changed, 127 insertions(+), 127 deletions(-)
next reply other threads:[~2026-02-08 18:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-08 18:38 Steven Rostedt [this message]
2026-02-08 18:38 ` [PATCH v3 1/3] tracing: Rename trace_array field max_buffer to snapshot_buffer Steven Rostedt
2026-02-08 18:38 ` [PATCH v3 2/3] tracing: Add tracer_uses_snapshot() helper to remove #ifdefs Steven Rostedt
2026-02-08 18:38 ` [PATCH v3 3/3] tracing: Better separate SNAPSHOT and MAX_TRACE options 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=20260208183832.118080581@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--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 \
/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