From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Xiang Gao <gxxa03070307@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Vincent Donnefort <vdonnefort@google.com>,
Donggeun Yoo <donggeunyoo.kernel@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-kernel@vger.kernel.org, Xiang Gao <gaoxiang17@xiaomi.com>
Subject: Re: [PATCH v4 2/2] tracing: add per-CPU memory usage statistics in tracefs
Date: Thu, 24 Sep 2026 10:36:21 +0900 [thread overview]
Message-ID: <20260924103621.734c895420a97a2d6f36332e@kernel.org> (raw)
In-Reply-To: <20260921113047.1152602-3-gaoxiang17@xiaomi.com>
On Mon, 21 Sep 2026 19:30:46 +0800
Xiang Gao <gxxa03070307@gmail.com> wrote:
> +static struct trace_mem_stats trace_buffers_memory_cpu(int cpu)
> +{
> + struct trace_mem_stats stats = {};
> + struct trace_array *tr;
> +
> + guard(mutex)(&trace_types_lock);
> +
> + list_for_each_entry(tr, &ftrace_trace_arrays, list)
> + trace_array_buffer_memory(tr, cpu, &stats.buffers,
> + &stats.snapshot);
> +
> + /* Account for the bootstrapping temp_buffer as well. */
> + if (temp_buffer)
> + stats.buffers += ring_buffer_memory_size(temp_buffer, cpu);
> +
> + return stats;
> +}
> +
> +static int trace_mem_per_cpu_show(struct seq_file *m, void *v)
> +{
> + struct trace_mem_stats stats = trace_buffers_memory_cpu((long)m->private);
> +
> + seq_printf(m, "buffers: %lu\n", stats.buffers >> 10);
> + seq_printf(m, "snapshot_buffers: %lu\n", stats.snapshot >> 10);
> +
> + return 0;
> +}
> +
> +static int trace_mem_per_cpu_open(struct inode *inode, struct file *file)
> +{
> + int ret;
> +
> + ret = tracing_check_open_get_tr(NULL);
> + if (ret)
> + return ret;
> +
> + return single_open(file, trace_mem_per_cpu_show, inode->i_private);
> +}
> +
> +static const struct file_operations trace_mem_per_cpu_fops = {
> + .open = trace_mem_per_cpu_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> +};
> +
These functions seems like a dead copy of non-per-cpu version. Can you
reuse the same code?
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-09-24 1:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 11:27 [PATCH 0/2] tracing: add ring-buffer memory usage statistics Xiang Gao
2026-09-05 11:27 ` [PATCH 1/2] tracing: add ring-buffer memory usage statistics in tracefs Xiang Gao
2026-09-05 11:38 ` sashiko-bot
2026-09-07 9:26 ` Vincent Donnefort
2026-09-05 11:27 ` [PATCH 2/2] tracing: add per-CPU " Xiang Gao
2026-09-11 15:50 ` [PATCH v2 0/2] tracing: add ring-buffer memory usage statistics Xiang Gao
2026-09-11 15:50 ` [PATCH v2 1/2] tracing: add ring-buffer memory usage statistics in tracefs Xiang Gao
2026-09-11 16:04 ` sashiko-bot
2026-09-13 16:37 ` Donggeun Yoo
2026-09-11 15:50 ` [PATCH v2 2/2] tracing: add per-CPU " Xiang Gao
2026-09-16 6:33 ` [PATCH v3 0/2] tracing: add ring-buffer memory usage statistics Xiang Gao
2026-09-16 6:33 ` [PATCH v3 1/2] tracing: add ring-buffer memory usage statistics in tracefs Xiang Gao
2026-09-16 6:50 ` sashiko-bot
2026-09-16 6:33 ` [PATCH v3 2/2] tracing: add per-CPU " Xiang Gao
2026-09-21 11:30 ` [PATCH v4 0/2] tracing: add ring-buffer memory usage statistics Xiang Gao
2026-09-21 11:30 ` [PATCH v4 1/2] tracing: add ring-buffer memory usage statistics in tracefs Xiang Gao
2026-09-22 9:41 ` Vincent Donnefort
2026-09-24 1:27 ` Masami Hiramatsu
2026-09-24 8:54 ` Vincent Donnefort
2026-09-25 1:09 ` Masami Hiramatsu
2026-09-21 11:30 ` [PATCH v4 2/2] tracing: add per-CPU " Xiang Gao
2026-09-22 9:42 ` Vincent Donnefort
2026-09-24 1:36 ` Masami Hiramatsu [this message]
2026-09-11 17:22 ` [PATCH 0/2] tracing: add ring-buffer memory usage statistics Vincent Donnefort
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=20260924103621.734c895420a97a2d6f36332e@kernel.org \
--to=mhiramat@kernel.org \
--cc=donggeunyoo.kernel@gmail.com \
--cc=gaoxiang17@xiaomi.com \
--cc=gaoxu2@honor.com \
--cc=gxxa03070307@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
--cc=vdonnefort@google.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.