linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Limit dentry cache entries
@ 2013-05-20  3:50 Keyur Govande
  2013-05-20 12:20 ` Bob Peterson
  2013-05-20 22:53 ` Dave Chinner
  0 siblings, 2 replies; 11+ messages in thread
From: Keyur Govande @ 2013-05-20  3:50 UTC (permalink / raw)
  To: linux-fsdevel

Hello,

We have a bunch of servers that create a lot of temp files, or check
for the existence of non-existent files. Every such operation creates
a dentry object and soon most of the free memory is consumed for
'negative' dentry entries. This behavior was observed on both CentOS
kernel v.2.6.32-358 and Amazon Linux kernel v.3.4.43-4.

There are also some processes running that occasionally allocate large
chunks of memory, and when this happens the kernel clears out a bunch
of stale dentry caches. This clearing takes some time. kswapd kicks
in, and allocations and bzero() of 4GB that normally takes <1s, takes
20s or more.

Because the memory needs are non-continuous but negative dentry
generation is fairly continuous, vfs_cache_pressure doesn't help much.

The thought I had was to have a sysctl that limits the number of
dentries per super-block (sb-max-dentry). Everytime a new dentry is
allocated in d_alloc(), check if dentry_stat.nr_dentry exceeds (number
of super blocks * sb-max-dentry). If yes, queue up an asynchronous
workqueue call to prune_dcache(). Also have a separate sysctl to
indicate by what percentage to reduce the dentry entries when this
happens.

Thanks for your input. If this sounds like a reasonable idea, I'll
send out a patch.

Cheers,
Keyur.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-05-28 17:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20  3:50 Limit dentry cache entries Keyur Govande
2013-05-20 12:20 ` Bob Peterson
2013-05-25  3:03   ` Keyur Govande
2013-05-20 22:53 ` Dave Chinner
2013-05-25  3:12   ` Keyur Govande
2013-05-26 23:23     ` Dave Chinner
2013-05-28  6:12       ` Keyur Govande
2013-05-28  6:24         ` Keyur Govande
2013-05-28 10:49         ` Dave Chinner
2013-05-28 16:42           ` Keyur Govande
2013-05-28 17:14             ` Keyur Govande

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).