Linux Trace Kernel
 help / color / mirror / Atom feed
* [RFC] tracing: aggregate ring-buffer usage statistics
@ 2026-08-11 11:48 Xiang Gao
  2026-08-11 14:08 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Xiang Gao @ 2026-08-11 11:48 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Lorenzo Stoakes, gao xu,
	yinchuang1, linux-trace-kernel, linux-kernel, linux-mm, Xiang Gao

Hi,

I would like to clarify the motivation for a tracing-specific memory
usage interface.

The original requirement comes from Android lost-RAM attribution.
Ftrace ring-buffer data pages are not represented as a separate memory
category, so userspace memory diagnostics may treat them as lost RAM.

The memory can be spread across the global trace array, dynamically
created tracing instances, and snapshot buffers. Userspace can read
buffer_total_size_kb for the global trace array and each instance, but
it has to discover and sum all instances, and snapshot buffer capacity
is not exposed through the same per-instance total.

On one Android device, the global buffer and 24 tracing instances
accounted for 395,664 kB of ring-buffer data capacity. This makes the
missing attribution significant for low-memory diagnostics.

The core requirement is a stable tracing-specific interface that allows
userspace to obtain the aggregate tracing buffer usage without walking
all instances. It does not need to be part of /proc/meminfo or
show_mem().

One possible interface would be under:

  /sys/kernel/tracing/trace_stats/

It could provide an aggregate buffer value together with a breakdown
for main and snapshot buffers. Per-CPU statistics could also be added
if useful.

Thanks,
Xiang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-12 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 11:48 [RFC] tracing: aggregate ring-buffer usage statistics Xiang Gao
2026-08-11 14:08 ` Steven Rostedt
     [not found]   ` <cd441eb194d54265b1bf9ab659716c45@xiaomi.com>
2026-08-12 15:47     ` [External Mail]Re: " Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox