public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Thaeter <ct@pipapo.org>
To: linux-kernel@vger.kernel.org
Subject: [BUG?] vfs_cache_pressure=0 does not free inode caches
Date: Tue, 14 Apr 2009 17:54:45 +0200	[thread overview]
Message-ID: <49E4B1C5.2070109@pipapo.org> (raw)

Some time ago I found out that setting vfs_cache_pressure to 0 gives a
decent performance boost on my laptop (4200prm 1.8" disk). In most cases
metadata intensive/seeking applications (git, make, ..) wont even need
to spin up the disk (ls -R / takes 4 seconds from cache). Thats great
and I am using that since some time now. My first observation (looking
at 'top') was that caches get still freed when memory is demanded otherwise.

But now I hit the wall with really huge directory traversals on a
smaller server. Some testing revealed that the inode caches (tested with
ext4 and xfs) of the file system are not freed at all. The server is
going to die a slow death, all user space memory is swapped out, then
all processes are OOM killed until it dies from complete memory exhaustion.

Looking at the source (fs/inode.c):

static int shrink_icache_memory(int nr, gfp_t gfp_mask)
{
  ...
  return (inodes_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
}

makes me no wonder, I didn't investigated this further. Just trying with
 vfs_cache_pressure=1 gives the desired result and the inode caches are
freed on demand, case settled.

But still this has some bad taste, a cache is supposed to be a cache and
not a memory hog. The documentation doesn't cover this case. It is
argueable if this now can be considered as bug or as feature. I think
the formula for cache shrinking should be fixed to free memory even in
this extreme cases, others may argue that turning this cache off is a
feature, but then it should be documented at least.


	Christian


             reply	other threads:[~2009-04-14 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 15:54 Christian Thaeter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-05-10 17:26 [BUG?] vfs_cache_pressure=0 does not free inode caches Alexander Stohr
2010-05-10 21:18 ` Andrew Morton
2010-05-11  8:47 Alexander Stohr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49E4B1C5.2070109@pipapo.org \
    --to=ct@pipapo.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox