mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Unused trace event in erofs
@ 2025-06-13  2:49 Steven Rostedt
  2025-06-13  6:08 ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2025-06-13  2:49 UTC (permalink / raw)
  To: LKML, linux-erofs; +Cc: Gao Xiang, Chao Yu

I have code that will trigger a warning if a trace event is defined but
not used[1]. It gives a list of unused events. Here's what I have for
erofs:

warning: tracepoint 'erofs_destroy_inode' is unused.

Each trace event can take up to around 5K in memory regardless if they
are used or not. Soon there will be warnings when they are defined but
not used. Please remove any unused trace event or at least hide it
under an #ifdef if they are used within configs. I'm planning on adding
these warning in the next merge window.

Thanks,

-- Steve

[1] https://lore.kernel.org/linux-trace-kernel/20250612235827.011358765@goodmis.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unused trace event in erofs
  2025-06-13  2:49 Unused trace event in erofs Steven Rostedt
@ 2025-06-13  6:08 ` Gao Xiang
  2025-06-13 12:17   ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2025-06-13  6:08 UTC (permalink / raw)
  To: Steven Rostedt, LKML, linux-erofs; +Cc: Gao Xiang, Chao Yu

Hi Steven,

On 2025/6/13 10:49, Steven Rostedt wrote:
> I have code that will trigger a warning if a trace event is defined but
> not used[1]. It gives a list of unused events. Here's what I have for
> erofs:
> 
> warning: tracepoint 'erofs_destroy_inode' is unused.

I'm fine to remove it, also I wonder if it's possible to disable
erofs tracepoints (rather than disable all tracepoints) in some
embedded use cases because erofs tracepoints might not be useful for
them and it can save memory (and .ko size) as you said below.

> 
> Each trace event can take up to around 5K in memory regardless if they
> are used or not. Soon there will be warnings when they are defined but
> not used. Please remove any unused trace event or at least hide it
> under an #ifdef if they are used within configs. I'm planning on adding
> these warning in the next merge window.

If you don't have some interest to submit a removal patch, I will post
a patch later.

Thanks,
Gao Xiang

> 
> Thanks,
> 
> -- Steve
> 
> [1] https://lore.kernel.org/linux-trace-kernel/20250612235827.011358765@goodmis.org/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unused trace event in erofs
  2025-06-13  6:08 ` Gao Xiang
@ 2025-06-13 12:17   ` Steven Rostedt
  2025-06-13 12:18     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2025-06-13 12:17 UTC (permalink / raw)
  To: Gao Xiang; +Cc: LKML, linux-erofs, Gao Xiang, Chao Yu

On Fri, 13 Jun 2025 14:08:32 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:

> Hi Steven,
> 
> On 2025/6/13 10:49, Steven Rostedt wrote:
> > I have code that will trigger a warning if a trace event is defined but
> > not used[1]. It gives a list of unused events. Here's what I have for
> > erofs:
> > 
> > warning: tracepoint 'erofs_destroy_inode' is unused.  
> 
> I'm fine to remove it, also I wonder if it's possible to disable
> erofs tracepoints (rather than disable all tracepoints) in some
> embedded use cases because erofs tracepoints might not be useful for
> them and it can save memory (and .ko size) as you said below.

You can add #ifdef around them.

Note, the "up to around 5K" means it can add up to that much depending on
what you have configured. The TRACE_EVENT() macro (and more specifically
the DECLARE_EVENT_CLASS() which TRACE_EVENT() has), is where all the bloat
is. I generates unique code for each trace event that prints it, parses it,
records it, the event fields, and has code specific for perf, ftrace and BPF.

The DEFINE_EVENT() which can be used to make several events that are
similar use the same DECLARE_EVENT_CLASS() only takes up around 250 bytes.
One reason I tell people to use DECLARE_EVENT_CLASS() when you have similar events.

There's also a DEFINE_EVENT_PRINT() that can use an existing
DECLARE_EVENT_CLASS() but update the "printk" section. That adds some more
code (the creation of the print function) but still much smaller than the
DECLARE_EVENT_CLASS(). But this requires the tracepoint function (what the
code calls) must have the same prototype.

> 
> > 
> > Each trace event can take up to around 5K in memory regardless if they
> > are used or not. Soon there will be warnings when they are defined but
> > not used. Please remove any unused trace event or at least hide it
> > under an #ifdef if they are used within configs. I'm planning on adding
> > these warning in the next merge window.  
> 
> If you don't have some interest to submit a removal patch, I will post
> a patch later.

Please make the patch. There's too many for me to do them all.

Thanks!

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unused trace event in erofs
  2025-06-13 12:17   ` Steven Rostedt
@ 2025-06-13 12:18     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2025-06-13 12:18 UTC (permalink / raw)
  To: Gao Xiang; +Cc: LKML, linux-erofs, Gao Xiang, Chao Yu

On Fri, 13 Jun 2025 08:17:28 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Please make the patch. There's too many for me to do them all.

You're not the only one with unused events. When I said there's "too many"
I meant in general, as you only have one ;-)

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-13 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-13  2:49 Unused trace event in erofs Steven Rostedt
2025-06-13  6:08 ` Gao Xiang
2025-06-13 12:17   ` Steven Rostedt
2025-06-13 12:18     ` 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®