On Mon, Jul 2, 2018 at 3:21 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Mon, Jul 02, 2018 at 02:18:11PM -0700, Andrew Morton wrote: > > > > Dumb question: do we know that negative dentries are actually > > worthwhile? Has anyone checked in the past couple of decades? Perhaps > > our lookups are so whizzy nowadays that we don't need them? > > I can't believe that's true. Yeah, I'm with Matthew. Negative dentries are absolutely *critical*. We have a shit-ton of stuff that walks various PATH-like things, trying to open a file in one directory after another. They also happen to be really fundamental to how the dentry cache itself works, with operations like "rename()" fundamentally depending on negative dentries. Sure, that "fundamental to rename()" could still be something that isn't actually ever *cached*, but the thing about many filesystems is that it's actually much more expensive to look up a file that doesn't exist than it is to look up one that does. That can be true even with things like hashed lookups, although it's more obviously true with legacy filesystems. Calling down to the filesystem every time you wonder "do I have a /usr/local/bin/cat" binary would be absolutely horrid. Also, honestly, I think the oom-killing thing says more about the issues we've had with the memory freeing code than about negative dentries. But the one problem with negative dentries is that it's fairly easy to create a shit-ton of them, so while we absolutely don't want to get rid of the concept, I do agree that having a limiter is a fine fine idea. Linus