Re: pruning dcache.

Bill Hawes (
Mon, 17 Nov 1997 11:55:10 -0500

Rogier Wolff wrote:
> Bill, Every two days or so someone steps up and says "what are these
> 'pruning dcache' messages doing in my log?". I want to join the chorus.
> On my system, it first said "3098 unused, pruning dcache" and then in
> quick succession, it then had 3097 unused twice in a row. I want to
> be assured that you don't have a "static" upper limit where you bump into
> and because no "reduction" is possible, the frequency of bumping into the
> limit goes up and up as nothing can be freed.

Hi Roger,
The pruning messages are harmless and just indicate that some dentries
were being freed to keep a reasonable balance of negative dentries.
Here's what's going on: normally most dentries carry an inode, but under
some conditions the system may generate a lot of negative dentries. The
most common operation that does this is a rm -rf on a large directory.

Negative dentries in small numbers are good, as they save time in
avoiding repeated lookups of files that don't exist. But if you get too
many, it slows down operations that need to search the unused dentry
list for inodes to free. (And it's very unlikely that anyone will do a
lookup on a file deleted in an rm -rf operation.)

The "pruning dcache" test is made against 3*nr_inodes/2 -- in other
words, we don't want the number of unused dentries to exceed 50% more
than the number of inodes in use. As the number of inodes may increase
from time to time, the test limit will change as well.

The latest version of my dcache patch is more aggressive at collecting
negative dentries, so the pruning dcache code in d_alloc is seldom
executed. (And the message is commented out anyway :-))

Hope this helps explain the reasons behind the messages ..