nfs: Only define atomic open tracepoints when NFSv4 is enabled
Subsystems (2)
PATCH v5 1/1 nfs: Only define atomic open tracepoints when NFSv4 is enabled
From: Yalagada Pavan Kumar <[email protected]>
Tracepoint definitions consume kernel memory even when they are not used. When tracepoints are only used in code compiled under a specific configuration, their definitions should also be guarded by the same configuration to avoid wasting memory.
The nfs_atomic_open_enter and nfs_atomic_open_exit tracepoints are only used in nfs_atomic_open(), which is compiled only when CONFIG_NFS_V4 is enabled. Guard their definitions with the same config to avoid unused tracepoints and reduce memory usage by approximately 8 KiB.
---
v5:
- Add Reviewed-by tag from Steven Rostedt.
v4:
- Clarify the commit message as suggested by Steven.
v3:
- Clarify why unused tracepoint definitions waste memory and include the measured memory reduction.
v2:
- Explain why the tracepoint definitions should be guarded.
v1: https://lore.kernel.org/outreachy/[email protected]/T/#t
--- fs/nfs/nfstrace.h | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/nfstrace.h +2 -0
@@ -514,6 +514,7 @@ DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup);DEFINE_NFS_LOOKUP_EVENT (nfs_readdir_lookup_revalidate_failed);DEFINE_NFS_LOOKUP_EVENT_DONE (nfs_readdir_lookup_revalidate); +#if IS_ENABLED (CONFIG_NFS_V4 ) TRACE_EVENT(nfs_atomic_open_enter, TP_PROTO( const struct inode *dir,
@@ -590,6 +591,7 @@ TRACE_EVENT(nfs_atomic_open_exit,__get_str (name) ) ); +#endif /* CONFIG_NFS_V4 */ TRACE_EVENT(nfs_create_enter, TP_PROTO(
Signature · 1 line
2.43.0