Re: [PATCH 00/11] fs/dcache: Limit # of negative dentries
From: Waiman Long <longman@redhat.com>
Date: 2020-02-28 15:47:24
Also in:
linux-fsdevel, lkml
On 2/27/20 3:30 AM, Dave Chinner wrote:
On Wed, Feb 26, 2020 at 11:13:53AM -0500, Waiman Long wrote:quoted
As there is no limit for negative dentries, it is possible that a sizeable portion of system memory can be tied up in dentry cache slabs. Dentry slabs are generally recalimable if the dentries are in the LRUs. Still having too much memory used up by dentries can be problematic:I don't get it. Why isn't the solution simply "constrain the application generating unbound numbers of dentries to a memcg"? Then when the memcg runs out of memory, it will start reclaiming the dentries that were allocated inside the memcg that are using all it's resources, thereby preventing unbound growth of the dentry cache. I mean, this sort of resource control is exactly what memcgs are supposed to be used for and are already used for. I don't see why we need all this complexity for global dentry resource management when memcgs should already provide an effective means of managing and placing bounds on the amount of memory any specific application can use...
Using memcg is one way to limit the damage. The argument that excessive negative dentries can push out existing memory objects that can be more useful if left alone still applies. Daemons that run in the root memcg has no limitation on how much memory that they can use. There can also be memcgs with high memory limits and long running applications. memcg is certainly a useful tool in this regards, but it doesn't solve all the problem. Cheers, Longman