Unused trace event in erofs
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]/
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]/
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
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
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 theDECLARE_EVENT_CLASS()whichTRACE_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 sameDECLARE_EVENT_CLASS()only takes up around 250 bytes. One reason I tell people to useDECLARE_EVENT_CLASS()when you have similar events.There's also a
DEFINE_EVENT_PRINT()that can use an existingDECLARE_EVENT_CLASS()but update the "printk" section. That adds some more code (the creation of the print function) but still much smaller than theDECLARE_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
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