Skip to contentSkip to conversation

Unused trace event in erofs

DISCUSSION Steven Rostedt 3 participants 6 messages Jun 13, 2025 – Jun 17, 2025

lore
Share & tools
lore
#0 lore raw

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/[email protected]/

#1 lore raw

Hi Steven,

Quoted 5 lines · Steven Rostedt

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.

Quoted 6 lines

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

Quoted 6 lines

Thanks,

-- Steve

[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/

#2 lore raw
Quoted 7 lines · On Fri, 13 Jun 2025 14:08:32 +0800 Gao Xiang <[email protected]>…

Hi Steven,

Quoted 4 lines · Steven Rostedt

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:

Quoted 6 lines
Quoted 1 line

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.

Quoted 10 lines
Quoted 7 lines

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

#3 lore raw
Quoted 1 line · On Fri, 13 Jun 2025 08:17:28 -0400 Steven Rostedt <[email protected]> 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

#4 lore raw
In reply to Steven Rostedt
Quoted 10 lines · Steven Rostedt
Quoted 7 lines · On Fri, 13 Jun 2025 14:08:32 +0800 Gao Xiang <[email protected]>…

Hi Steven,

Quoted 4 lines · Steven Rostedt

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:

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

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.

Should we introduce a new CONFIG to disable them?

Thanks,
Hongbo

Quoted 33 lines

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.

Quoted 10 lines
Quoted 7 lines

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

#5 lore raw
Quoted 15 lines · Hongbo Li
Quoted 12 lines · Steven Rostedt
Quoted 9 lines · On Fri, 13 Jun 2025 14:08:32 +0800 Gao Xiang <[email protected]>…

Hi Steven,

Quoted 5 lines · Steven Rostedt

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.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

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.

Should we introduce a new CONFIG to disable them?

I'd like to, and it seems much helpful to the embedded device users.

Thanks,
Gao Xiang