linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: touch up predicts in putname()
@ 2025-10-29 13:49 Mateusz Guzik
  2025-10-29 15:48 ` Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Mateusz Guzik @ 2025-10-29 13:49 UTC (permalink / raw)
  To: brauner; +Cc: viro, jack, linux-kernel, linux-fsdevel, Mateusz Guzik

1. we already expect the refcount is 1.
2. path creation predicts name == iname

I verified this straightens out the asm, no functional changes.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---

random annoyance i noticed while profiling

 fs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index ba29ec7b67c5..4692f25e7cd9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -282,7 +282,7 @@ void putname(struct filename *name)
 		return;
 
 	refcnt = atomic_read(&name->refcnt);
-	if (refcnt != 1) {
+	if (unlikely(refcnt != 1)) {
 		if (WARN_ON_ONCE(!refcnt))
 			return;
 
@@ -290,7 +290,7 @@ void putname(struct filename *name)
 			return;
 	}
 
-	if (name->name != name->iname) {
+	if (unlikely(name->name != name->iname)) {
 		__putname(name->name);
 		kfree(name);
 	} else
-- 
2.34.1


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

end of thread, other threads:[~2025-11-05  6:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29 13:49 [PATCH] fs: touch up predicts in putname() Mateusz Guzik
2025-10-29 15:48 ` Markus Elfring
2025-10-30 13:59 ` Jan Kara
2025-10-31 12:18 ` Christian Brauner
2025-10-31 20:17 ` Al Viro
2025-11-01  6:05   ` Al Viro
2025-11-01  8:19     ` Mateusz Guzik
2025-11-02  6:14       ` Al Viro
2025-11-02 22:42         ` Mateusz Guzik
2025-11-03  4:45           ` Al Viro
2025-11-03 16:44             ` Mateusz Guzik
2025-11-05  6:25               ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).