From: 高翔 <gaoxiang17@xiaomi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Xiang Gao" <gxxa03070307@gmail.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Lorenzo Stoakes" <ljs@kernel.org>, "gao xu" <gaoxu2@honor.com>,
印闯 <yinchuang1@xiaomi.com>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: 答复: [External Mail]Re: [RFC] tracing: aggregate ring-buffer usage statistics
Date: Thu, 13 Aug 2026 12:47:44 +0000 [thread overview]
Message-ID: <d5bb28119dbb4ff1ab1059bb2564ad29@xiaomi.com> (raw)
In-Reply-To: <20260812114704.2f61bc5a@gandalf.local.home>
[-- Attachment #1: Type: text/plain, Size: 2866 bytes --]
Thanks, Steve.
Understood.
I will add:
/sys/kernel/tracing/trace_stats/total_memory_kb
The file will report:
total:
buffers_mem:
snapshot_buffers_mem:
The values will cover the main and snapshot buffers of the global trace
array and all tracing instances across all tracing CPUs.
For the per-CPU view, I will follow the existing tracefs layout and add:
/sys/kernel/tracing/trace_stats/per_cpu/cpuN/total_memory_kb
Each per-CPU file will report only the corresponding CPU's buffers
across the global trace array and all tracing instances.
Thanks,
Xiang
________________________________
发件人: Steven Rostedt <rostedt@goodmis.org>
发送时间: 2026年8月12日 23:47:04
收件人: 高翔
抄送: Xiang Gao; Masami Hiramatsu; Mathieu Desnoyers; Lorenzo Stoakes; gao xu; 印闯; linux-trace-kernel@vger.kernel.org; linux-kernel@vger.kernel.org; linux-mm@kvack.org
主题: Re: [External Mail]Re: [RFC] tracing: aggregate ring-buffer usage statistics
[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xiaomi.com进行反馈
On Wed, 12 Aug 2026 13:21:29 +0000
高翔 <gaoxiang17@xiaomi.com> wrote:
> Thanks, Steve.
>
> For the initial implementation, I plan to add:
>
> /sys/kernel/tracing/trace_stats/total_memory_kb
>
> The file would use an extensible key/value format. Initially it would
> report the ring-buffer data capacity:
>
> total: 395664
> ring_buffer: 395664
> ring_buffer_live: 395544
> ring_buffer_snapshot: 120
You can rename the above to:
total:
buffers_mem:
snapshot_buffers_mem:
No need to use "ring" and it keeps consistent with "buffer_size_kb".
I added the "mem" part to distinguish the difference between these numbers
and the buffer_size_kb, as these numbers are about total memory whereas
the "buffer_size_kb" is about usable memory.
There's already a total for all memory listed. We don't need to have a
total for the "live" and "snapshot".
>
> Here, ring_buffer is the sum of ring_buffer_live and
> ring_buffer_snapshot. The values cover the global trace array and all
> tracing instances across all tracing CPUs.
>
> Additional accounted categories, such as event memory, could be appended
> later and included in total. Per-CPU statistics could be exposed
> separately under trace_stats/per_cpu/cpuN/ to avoid mixing aggregate and
> per-CPU values in one file.
Agreed, this file should exist in the cpuN/ directories and be only for
those instances.
>
> Userspace would parse fields by name and ignore unknown fields, so new
> categories can be added without changing the existing format.
Right. I would expect additional items to be added here.
>
> Does this initial format look reasonable?
>
Yes, thanks for doing this.
-- Steve
[-- Attachment #2: Type: text/html, Size: 4895 bytes --]
prev parent reply other threads:[~2026-08-13 12:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 11:48 [RFC] tracing: aggregate ring-buffer usage statistics Xiang Gao
2026-08-11 14:08 ` Steven Rostedt
2026-08-12 13:21 ` 答复: [External Mail]Re: " 高翔
2026-08-12 15:47 ` Steven Rostedt
2026-08-13 12:47 ` 高翔 [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=d5bb28119dbb4ff1ab1059bb2564ad29@xiaomi.com \
--to=gaoxiang17@xiaomi.com \
--cc=gaoxu2@honor.com \
--cc=gxxa03070307@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=yinchuang1@xiaomi.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