* [RFC] tracing: aggregate ring-buffer memory statistics
@ 2026-08-25 14:10 Xiang Gao
[not found] ` <93406afe7c684d649f11b05d7b6b7b7b@xiaomi.com>
2026-08-27 15:38 ` [RFC] " Steven Rostedt
0 siblings, 2 replies; 6+ messages in thread
From: Xiang Gao @ 2026-08-25 14:10 UTC (permalink / raw)
To: Steven Rostedt
Cc: Xiang Gao, Masami Hiramatsu, Mathieu Desnoyers, Lorenzo Stoakes,
Gao Xu, yinchuang1, linux-trace-kernel, linux-kernel
Hi,
This is a resend of the RFC for exposing tracing buffer memory
statistics under tracefs.
The motivation is Android lost-RAM attribution: tracing buffer memory
is not represented as a separate category, so it can be counted as lost
RAM. The memory can be spread across the global trace array, dynamically
created instances, and snapshot buffers, and userspace currently has to
discover and sum every instance.
The patch adds:
/sys/kernel/tracing/trace_stats/total_memory_kb
reporting:
total:
buffers_mem:
snapshot_buffers_mem:
The values cover the global trace array and all instances across all
CPUs. A per-CPU view is provided under:
/sys/kernel/tracing/trace_stats/per_cpu/cpuN/total_memory_kb
These *_mem values report the full pages backing the data sub-buffers
and reader page, unlike buffer_size_kb / buffer_total_size_kb which
report usable data capacity. The new trace_stats directory is distinct
from the existing trace_stat directory used for function and branch
counters.
For example, with 4 CPUs and 2 sub-buffers per CPU on a 4 KiB page
system:
buffer_size_kb = (4096 - 16) * 2 / 1024 = 7 kB (one CPU)
buffer_total_size_kb = 7 * 4 = 28 kB (one array)
buffers_mem = (2 + 1) * 4096 * 4 / 1024 = 48 kB
The extra memory in buffers_mem comes from the per-page header and the
reader page.
Slab-allocated ring-buffer metadata is not included.
One open question is whether reporting page memory only is acceptable
for the initial version.
Thanks,
Xiang
^ permalink raw reply [flat|nested] 6+ messages in thread[parent not found: <93406afe7c684d649f11b05d7b6b7b7b@xiaomi.com>]
* Re: [External Mail][RFC] tracing: aggregate ring-buffer memory statistics
[not found] ` <93406afe7c684d649f11b05d7b6b7b7b@xiaomi.com>
@ 2026-08-27 15:35 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2026-08-27 15:35 UTC (permalink / raw)
To: 高翔
Cc: Xiang Gao, Masami Hiramatsu, Mathieu Desnoyers, Lorenzo Stoakes,
Gao Xu, 印闯,
linux-trace-kernel, linux-kernel
On Thu, 27 Aug 2026 14:25:24 +0000
高翔 <gaoxiang17@xiaomi.com> wrote:
> Hi Steven.
>
It's good to ping after one week of no responses. RFCs tend to get low
priority and are looked at after fixes and other code needs to be reviewed.
But I'll take a look now anyway as I just finished sending out fixes.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] tracing: aggregate ring-buffer memory statistics
2026-08-25 14:10 [RFC] tracing: aggregate ring-buffer memory statistics Xiang Gao
[not found] ` <93406afe7c684d649f11b05d7b6b7b7b@xiaomi.com>
@ 2026-08-27 15:38 ` Steven Rostedt
[not found] ` <15c244f5bc8f4858b8ffa2974a46d009@xiaomi.com>
1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2026-08-27 15:38 UTC (permalink / raw)
To: Xiang Gao
Cc: Xiang Gao, Masami Hiramatsu, Mathieu Desnoyers, Lorenzo Stoakes,
Gao Xu, yinchuang1, linux-trace-kernel, linux-kernel
On Tue, 25 Aug 2026 22:10:15 +0800
Xiang Gao <gxxa03070307@gmail.com> wrote:
> Slab-allocated ring-buffer metadata is not included.
>
> One open question is whether reporting page memory only is acceptable
> for the initial version.
As supposed to what? The meta-data? I think meta-data is also good to show,
if it is allocated. Maybe as a separate line item?
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-02 14:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-25 14:10 [RFC] tracing: aggregate ring-buffer memory statistics Xiang Gao
[not found] ` <93406afe7c684d649f11b05d7b6b7b7b@xiaomi.com>
2026-08-27 15:35 ` [External Mail][RFC] " Steven Rostedt
2026-08-27 15:38 ` [RFC] " Steven Rostedt
[not found] ` <15c244f5bc8f4858b8ffa2974a46d009@xiaomi.com>
[not found] ` <88d476d443e74672957a5e0d1f8bf9ba@xiaomi.com>
2026-09-02 13:15 ` [External Mail]Re: " Steven Rostedt
[not found] ` <ca552a4c093b4498b2e308d266d5ab6f@xiaomi.com>
2026-09-02 14:39 ` Steven Rostedt
[not found] ` <e4c4d3f20b1445869ba329e561f6d042@xiaomi.com>
2026-09-02 14:48 ` Steven Rostedt
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®