Skip to contentSkip to conversation

namei: Remove unlikely annotation for revalidate check in lookup_fast()

PATCH In review Steven Rostedt 2 participants 3 messages Feb 6, 2017 – Feb 7, 2017 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 namei: Remove unlikely annotation for revalidate check in lookup_fast()

From: "Steven Rostedt (VMware)" <[email protected]>

The likely/unlikely profiler showed that the unlikely around the dentry->d_flags & DCACHE_OP_REVALIDATE was wrong 95% of the time. Adding trace_printk()s, it revealed that the dentry ops had hooks to:

kernfs_dop_revalidate
pid_revalidate
proc_sys_revalidate
tid_fd_revalidate

As tools today now access files that have these operations often, it's best just to remove the annotation, as it is more dependent on use cases and not normal mode of operation if it will be true or not.

---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +1 -1
index ad74877..23ce3e8 100644
@@ -1599,7 +1599,7 @@ static int lookup_fast(struct nameidata *nd,
 		dentry = __d_lookup(parent, &nd->last);
 		if (unlikely(!dentry))
 			return 0;
-		if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
+		if (dentry->d_flags & DCACHE_OP_REVALIDATE)
 			status = d_revalidate(dentry, nd->flags);
 	}
 	if (unlikely(status <= 0)) {
Signature · 1 line
2.9.3
maintainer
#1 lore raw
Quoted 6 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

The likely/unlikely profiler showed that the unlikely around the dentry->d_flags & DCACHE_OP_REVALIDATE was wrong 95% of the time. Adding trace_printk()s, it revealed that the dentry ops had hooks to:

Quoted 8 lines

kernfs_dop_revalidate
pid_revalidate
proc_sys_revalidate
tid_fd_revalidate

As tools today now access files that have these operations often, it's best just to remove the annotation, as it is more dependent on use cases and not normal mode of operation if it will be true or not.

"Tools" being what, exactly? What kind of load had that been measured on?

#2 lore raw
Quoted 12 lines · On Tue, 7 Feb 2017 00:06:42 +0000 Al Viro <[email protected]> wrote:
Quoted 11 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

The likely/unlikely profiler showed that the unlikely around the dentry->d_flags & DCACHE_OP_REVALIDATE was wrong 95% of the time. Adding trace_printk()s, it revealed that the dentry ops had hooks to:

kernfs_dop_revalidate
pid_revalidate
proc_sys_revalidate
tid_fd_revalidate

Quoted 5 lines
Quoted 3 lines

As tools today now access files that have these operations often, it's best just to remove the annotation, as it is more dependent on use cases and not normal mode of operation if it will be true or not.

"Tools" being what, exactly? What kind of load had that been measured on?

I first saw it on my system that I ran for 3 weeks. But I investigated it more on a test box that was mostly idle. On the test box the "tools" was mostly systemd and journald. I can look deeper into it if you like.

-- Steve