On Fri, Apr 11, 2025 at 11:40:28AM +0200, Miklos Szeredi wrote: > There are reports of soflockups in fsnotify if there are large numbers > of negative dentries (e.g. ~300M) in a directory. This can happen if > lots of temp files are created and removed and there's not enough > memory pressure to trigger the lru shrinker. > > These are on old kernels and some of this is possibly due to missing > 172e422ffea2 ("fsnotify: clear PARENT_WATCHED flags lazily"), but I > managed to reproduce the softlockup on a recent kernel in > fsnotify_set_children_dentry_flags() (see end of mail). > > This was with ~1.2G negative dentries. Doing "rmdir testdir" > afterwards does not trigger the softlockup detector, due to the > reschedules in shrink_dcache_parent() code, but it took 10 minutes(!) > to finish removing that empty directory. > I wrote about this some time ago: https://lore.kernel.org/linux-fsdevel/f7bp3ggliqbb7adyysonxgvo6zn76mo4unroagfcuu3bfghynu@7wkgqkfb5c43/#t bottom line is only a small subset of negative entries is useful in the long run while a great policy to tame the total count while not hindering performance is left as an exercise for the reader(tm), I outlined something which should be *tolerable*.