From: Steven Rostedt <rostedt@goodmis.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-xfs@vger.kernel.org, Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Carlos Maiolino <cem@kernel.org>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 00/14] xfs: Remove unused trace events
Date: Fri, 13 Jun 2025 11:31:19 -0400 [thread overview]
Message-ID: <20250613113119.24943f6d@batman.local.home> (raw)
In-Reply-To: <20250613150855.GQ6156@frogsfrogsfrogs>
On Fri, 13 Jun 2025 08:08:55 -0700
"Darrick J. Wong" <djwong@kernel.org> wrote:
> On Thu, Jun 12, 2025 at 05:24:05PM -0400, Steven Rostedt wrote:
> >
> > Trace events take up to 5K in memory for text and meta data. I have code that
>
> Under what circumstances do they eat up that much memory? And is that
> per-class? Or per-tracepoint?
I just did an analysis of this:
https://lore.kernel.org/lkml/20250613104240.509ff13c@batman.local.home/T/#md81abade0df19ba9062fd51ced4458161f885ac3
A TRACE_EVENT() is about 5K, and each DEFINE_EVENT() is about 1K.
>
> > will trigger a warning when it detects unused tracepoints. The XFS file
> > system contains many events that are not called. Most of them used to be called
> > but due to code refactoring the calls were removed but the trace events stayed
> > behind.
> >
> > Some events were added but never used. If they were recent, I just reported
> > them, but if they were older, this series simply removes them.
>
> TBH it'd be really nice if there was /something/ in the build path that
> would complain about disused tracepoints. I often put in tracepoints
> while developing a feature, then the code gets massively rewritten
> during review, and none of us remember to rip out the orphaned traces...
>
That's exactly what I'm doing. In the thread I did the analysis, it has
code that triggers a warning for unused events. I'm currently cleaning
them up (and asking others to do it too), so that I can add that code
without triggering all the current unused tracepoints.
Feel free to take those patches and it will warn at build time. Note,
it currently only works for built in code, so you have to build your
module as a built in and not a module.
> > One is called only when CONFIG_COMPACT is defined, so an #ifdef was placed
> > around it.
> >
> > A couple are only called in #if 0 code (left as a reminder to fix it), so
> > those events are wrapped by a #if 0 as well (with a comment).
> >
> > Finally, one event is supposed to be a trace event class, but was created with
> > the TRACE_EVENT() macro and not the DECLARE_EVENT_CLASS() macro. This works
> > because a TRACE_EVENT() is simply a DECLARE_EVENT_CLASS() and DEFINE_EVENT()
> > where the class and event have the same name. But as this was a mistake, the
> > event created should not exist.
> >
> > Each patch is a stand alone patch. If you ack them, I can take them in my
> > tree, or if you want, you can take them. I may be adding the warning code to
> > linux-next near the end of the cycle, so it would be good to have this cleaned
> > up before hand. As this is removing dead code, it may be even OK to send them
> > to Linus as a fix.
>
> ...oh, you /do/ have a program and it's coming down the pipeline.
> Excellent <tents fingers>. :)
Ah you did notice ;-)
-- Steve
next prev parent reply other threads:[~2025-06-13 15:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 21:24 [PATCH 00/14] xfs: Remove unused trace events Steven Rostedt
2025-06-12 21:24 ` [PATCH 01/14] xfs: tracing; Remove unused event xfs_reflink_cow_found Steven Rostedt
2025-06-13 15:38 ` Steven Rostedt
2025-06-13 23:52 ` kernel test robot
2025-06-12 21:24 ` [PATCH 02/14] xfs: Remove unused trace event xfs_attr_remove_iter_return Steven Rostedt
2025-06-16 5:26 ` Christoph Hellwig
2025-06-16 14:51 ` Steven Rostedt
2025-06-12 21:24 ` [PATCH 03/14] xfs: Remove unused event xlog_iclog_want_sync Steven Rostedt
2025-06-12 21:24 ` [PATCH 04/14] xfs: Remove unused event xfs_ioctl_clone Steven Rostedt
2025-06-12 21:24 ` [PATCH 05/14] xfs: Remove unused xfs_reflink_compare_extents events Steven Rostedt
2025-06-12 21:24 ` [PATCH 06/14] xfs: Remove unused trace event xfs_attr_rmtval_set Steven Rostedt
2025-06-12 21:24 ` [PATCH 07/14] xfs: ifdef out unused xfs_attr events Steven Rostedt
2025-06-16 5:28 ` Christoph Hellwig
2025-06-16 14:52 ` Steven Rostedt
2025-06-17 4:46 ` Christoph Hellwig
2025-06-12 21:24 ` [PATCH 08/14] xfs: Remove unused event xfs_attr_node_removename Steven Rostedt
2025-06-12 21:24 ` [PATCH 09/14] xfs: Remove unused event xfs_alloc_near_error Steven Rostedt
2025-06-12 21:24 ` [PATCH 10/14] xfs: Remove unused event xfs_alloc_near_nominleft Steven Rostedt
2025-06-12 21:24 ` [PATCH 11/14] xfs: Remove unused event xfs_pagecache_inval Steven Rostedt
2025-06-12 21:24 ` [PATCH 12/14] xfs: Remove usused xfs_end_io_direct events Steven Rostedt
2025-06-12 21:24 ` [PATCH 13/14] xfs: Only create event xfs_file_compat_ioctl when CONFIG_COMPAT is configure Steven Rostedt
2025-06-12 21:24 ` [PATCH 14/14] xfs: Change xfs_xattr_class from a TRACE_EVENT() to DECLARE_EVENT_CLASS() Steven Rostedt
2025-06-13 15:08 ` [PATCH 00/14] xfs: Remove unused trace events Darrick J. Wong
2025-06-13 15:31 ` Steven Rostedt [this message]
2025-06-16 5:31 ` Christoph Hellwig
2025-06-16 14:58 ` Steven Rostedt
2025-07-23 22:35 ` Steven Rostedt
2025-06-16 5:30 ` Christoph Hellwig
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=20250613113119.24943f6d@batman.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).