Re: [LSF/MM TOPIC] Better handling of negative dentries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 22, 2022 at 02:19:30PM -0700, Roman Gushchin wrote:
> 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).

Those aren't independent shrinkers - they are part of the superblock
shrinker.  XFS just uses these for background management of the VFS
inode cache footprint - vfs inodes live a bit longer than
->destroy_inode in XFS - so these callouts from the superblock
shrinker are really just part of the existing VFS inode cache
management.

> 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.

The xfs buffer cache has slab allocated handles that can pin up to
64kB of pages each. The buffer cache can quickly grow to hold tens
of gigabytes of memory when you have filesystems with hundreds of
gigabytes of metadata in them (which are not that uncommon). It's
also not uncommon for the XFS buffer cache to consume more memory
than the VFS dentry and inode caches combined.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux