All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] nfs: Only define atomic open tracepoints when NFSv4 is enabled
@ 2026-11-01  0:08 pavankumaryalagada
  2026-11-07 21:53 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: pavankumaryalagada @ 2026-11-01  0:08 UTC (permalink / raw)
  To: outreachy; +Cc: rostedt, julianbraha, Yalagada Pavan Kumar

From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>

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() in fs/nfs/dir.c, 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.

Fixes: 6e0d0be715fe ("NFS: Add event tracing for generic NFS lookups")
Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
---
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/E78430D8-5F7C-47FD-ADE7-6AA995F88A53@inria.fr/T/#t
---
 fs/nfs/nfstrace.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index b15c1732c869..1b17e8b02692 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -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(
-- 
2.43.0


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

* Re: [PATCH v3] nfs: Only define atomic open tracepoints when NFSv4 is enabled
  2026-11-01  0:08 [PATCH v3] nfs: Only define atomic open tracepoints when NFSv4 is enabled pavankumaryalagada
@ 2026-11-07 21:53 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2026-11-07 21:53 UTC (permalink / raw)
  To: pavankumaryalagada; +Cc: outreachy, julianbraha

On Sun,  1 Nov 2026 05:38:43 +0530
pavankumaryalagada@gmail.com wrote:

> From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
> 
> 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() in fs/nfs/dir.c, which is compiled
> only when CONFIG_NFS_V4 is enabled. Guard their definitions with

Could you reword the above slightly, as I read the "which is complied"
to be fs/nfs/dir.c and not the function. Perhaps just remove the "in
fs/nfs/dir.c" part. The nfs_atomic_open() should be unique enough to
know where the issue is.

Thanks,

-- Steve


> the same config to avoid unused tracepoints and reduce memory usage
> by approximately 8 KiB.
> 
> Fixes: 6e0d0be715fe ("NFS: Add event tracing for generic NFS lookups")
> Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>

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

end of thread, other threads:[~2026-11-07 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01  0:08 [PATCH v3] nfs: Only define atomic open tracepoints when NFSv4 is enabled pavankumaryalagada
2026-11-07 21:53 ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.