Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/namei: Remove redundant DCACHE_MANAGED_DENTRY check in __follow_mount_rcu

The check for DCACHE_MANAGED_DENTRY at the start of __follow_mount_rcu()
is redundant because the only caller (handle_mounts) already verifies
d_managed(dentry) before calling this function, so, dentry in
__follow_mount_rcu() has always DCACHE_MANAGED_DENTRY set.

This early-out optimization never fires in practice - but it is marking
as likely().

This was detected with branch profiling, which shows 100% misprediction
in this likely.

Remove the whole if clause instead of removing the likely, given we
know for sure that dentry is not DCACHE_MANAGED_DENTRY.

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260105-dcache-v1-1-f0d904b4a7c2@debian.org
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Breno Leitao and committed by
Christian Brauner
a6b9f5b2 729d015a

-3
-3
fs/namei.c
··· 1624 1624 struct dentry *dentry = path->dentry; 1625 1625 unsigned int flags = dentry->d_flags; 1626 1626 1627 - if (likely(!(flags & DCACHE_MANAGED_DENTRY))) 1628 - return true; 1629 - 1630 1627 if (unlikely(nd->flags & LOOKUP_NO_XDEV)) 1631 1628 return false; 1632 1629