On Thu, Aug 11, 2022 at 02:52:26PM -0700, Linus Torvalds wrote: > On Thu, Aug 11, 2022 at 2:38 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > > > Exporting the functionality? Sure, no problem. Uninlining that one... > > I suspect that it's OK, but I'd like to see profiling data; it's not > > as if it would be hard to return to having it inlined, obviously. > > The only case where I think it might matter is in __d_lookup(), and > it's probably not measurable. > > Yes, __d_lookup() does matter, but it only matters once you've fallen > out of RCU mode, and at that point the cost of the function call is > likely in the noise. > > I don't particularly like how it's inside that dentry hash chain loop, > but realistically by then we've already done a function call for the > dentry lock spinlock, so that loop already has to deal with it. FWIW, I wonder if we should do if (READ_ONCE(dentry->d_parent) != parent) continue; before grabbing ->d_lock (and repeat the check after grabbing it, of course). It's OK from correctness POV - we are OK with false negatives from __d_lookup() if concurrent rename happens. And it just might be a sufficiently large performance win...