Subject: Re: How does UBC caching work?
To: Matthias Scheler <tron@zhadum.de>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-perform
Date: 07/09/2002 11:48:39
Matthias Scheler wrote:
> On Tue, Jul 09, 2002 at 10:56:48AM +0200, Jaromir Dolecek wrote:
> > > Is inode/vnode cache still fixed-size?
> > 
> > You can adjust vnode cache size via sysctl kern.maxvnodes
> > (I have it bumped to 50000 in my  /etc/sysctl.conf)
> 
> How much memory does a vnode in the cache cosume? Is it just the size
> of a "struct vnode"?

Yes, struct vnode + filesystem-specific context ('inode' for FFS,
'denode' for msdosfs etc). Plus any file data cached by UBC, but that
is subject to common UBC memory cache rules.

That reminds me - I've recently used high kern.maxvnodes setting
on machine with low memory, and the machine started trashing after
sufficient number of files were read (e.g. during source tree
compilation), even through I had vm.filemax=10. There might be
problem in that file data remain in UBC cache even through the
memory is needed for other purposes and file data are over vm.filemax.

Anyway, general rule for kern.maxvnodes is like (from Bill Sommerfeld):

kern.maxvnodes = (amount-memory-used-for-cache)/(common-file-size)

where common-file-size is about 4-8 KB on unix.

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-