Re: [PATCH v4 0/5] Fix easy bits of the negative dentry problem
From: NeilBrown
Date: Sun Oct 18 2026 - 22:29:59 EST
On Mon, 19 Oct 2026, Ian Kent wrote:
>
> As is so often the case you've come up with an interesting and useful
> proposal, ;)
>
> Nothing stood to me out as problematic given the scope of the series.
Thanks :-)
>
> >
> >
> > [PATCH v4 1/5] VFS: don't count references through ->d_parent
> > [PATCH v4 2/5] fsnotify: update children flags only when adding mask
> > [PATCH v4 3/5] fsnotify: don't hold i_lock while walking d_children
> > [PATCH v4 4/5] Add d_for_each_positive_child family of iterators
> > [PATCH v4 5/5] Use d_for_each_positive_child() in fsnotify.
>
> Did you have any thoughts on how to contain the number of negative
> dentries, (perhaps) including directory entry counts, in an intelligent
> way (meaning "as you go" rather than "brute force" when needed)?
>
> A significant problem, particularly on systems that count their memory
> in TBs rather than GBs.
I would need to understand *why* this is a significant problem, which as
yet I don't.
Allocating things that don't get used much isn't intrinsically a
problem. We have a shrinker which will gradually removed them - or less
gradually when memory is short.
But maybe shrinker activity itself is a problem? Is that it?
I think it could make sense to separate positive and negative dentries
on the d_children list. This is quite do-able, though there is a small
cost when a dentry transitions from one to the other.
The only other thing I remember from the lwn article and the various
other articles and emails it referenced, was something about poor LRU
performance. Lots of largely useless negative dentries push more useful
positive dentries to the end of the LRU and we lose them too soon.
I think that can be addressed by having separate LRUs for positive and
negative dentries, and giving them different weights. I think the
cost of this would be tiny, but I'm not confident of the benefit.
Is there some other concrete symptom that I didn't notice (or have
forgotten)?
Thanks,
NeilBrown
>
> Ian
>