On Tue, Mar 22, 2022 at 08:41:56PM +0000, Matthew Wilcox wrote: > On Tue, Mar 15, 2022 at 01:56:18PM -0700, Roman Gushchin wrote: > > I’d be happy to join this discussion. And in my opinion it’s going > > beyond negative dentries: there are other types of objects which tend > > to grow beyond any reasonable limits if there is no memory pressure. > > > > A perfect example when it happens is when a machine is almost idle > > for some period of time. Periodically running processes creating > > various kernel objects (mostly vfs cache) which over time are filling > > significant portions of the total memory. And when the need for memory > > arises, we realize that the memory is heavily fragmented and it’s > > costly to reclaim it back. > > When you say "vfs cache", do you mean page cache, inode cache, or > something else? Mostly inodes and dentries, but also in theory some fs-specific objects (e.g. xfs implements nr_cached_objects/free_cached_objects callbacks). Also dentries, for example, can have attached kmalloc'ed areas if the length of the file's name is larger than x. And probably there are more examples of indirectly pinned objects.