mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiang Gao <gxxa03070307@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: 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-kernel@vger.kernel.org, linux-mm@kvack.org,
	Xiang Gao <gaoxiang17@xiaomi.com>
Subject: [RFC] tracing: aggregate ring-buffer usage statistics
Date: Tue, 11 Aug 2026 19:48:18 +0800	[thread overview]
Message-ID: <20260811114818.1449933-1-gaoxiang17@xiaomi.com> (raw)

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

             reply	other threads:[~2026-08-11 11:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 11:48 Xiang Gao [this message]
2026-08-11 14:08 ` Steven Rostedt
     [not found]   ` <cd441eb194d54265b1bf9ab659716c45@xiaomi.com>
2026-08-12 15:47     ` [External Mail]Re: " Steven Rostedt
     [not found]       ` <d5bb28119dbb4ff1ab1059bb2564ad29@xiaomi.com>
     [not found]         ` <0e42953988164786aafe175ef0f4e745@xiaomi.com>
     [not found]           ` <11242d2e40eb4fd4b439ac66ebbe26ed@xiaomi.com>
2026-08-18 14:24             ` 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=20260811114818.1449933-1-gaoxiang17@xiaomi.com \
    --to=gxxa03070307@gmail.com \
    --cc=gaoxiang17@xiaomi.com \
    --cc=gaoxu2@honor.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

all inboxes | Powered by JetHome®