Subject: Re: Limiting memory usage of bufcache?
To: Jukka Marin <jmarin@pyy.jmp.fi>
From: Oleg Polianski <Oleg.Polianski@clear.co.nz>
List: netbsd-users
Date: 08/22/2001 18:12:31
Jukka Marin <jmarin@pyy.jmp.fi> writes:

> I would like to limit the amount of RAM used by disk buffer/cache.  I'm
> running a 1.5W kernel and after copying a few gigs of data (creating a
> backup, for example), all programs have been paged out and moving focus
> to another xterm causes massive disk I/O (paging) and the machine is
> useless for several seconds (in some cases).  I know my Barracuda disk
> isn't the fastest any more, but even if I upgraded it, the problem would
> still remain.
> 
> So, how do I tell the system to use 64 MB or 128 MB _max_ for disk cache
> and leave the rest of the RAM alone?

 Actually, if I'm not mistaken, the real reason is not the buffer cache
 itself but buffer pool that is used for metadata storing. The problem is
 that it cannot grow dynamically and its size is fixed and calculated during
 the system startup procedure based on the BUFCACHE option inside `bufinit'
 kernel subroutine (`/sys/kern/vfs_bio.c'). So, the real I/O thrashing
 usually is caused by relatively small or, probably, not very effective
 buffer pool management. You can see the real size of your buffer pool in
 `dmesg' output, i.e. something like this:

using 6574 buffers containing 26296 KB of memory

 (these numbers are for machine with 0.5Gb of RAM). Please feel free to
 correct me if I'm wrong - I'm not VM expert.

Oleg