diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2009-06-05 04:29:15 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2009-06-05 04:29:15 +0000 |
commit | 99719d09f990cf65f3f9922bab47d9a3e85b2974 (patch) | |
tree | 58c7cbb3c436901aceaaac35dff58cea1e8eac2f /sys/kern/kern_sysctl.c | |
parent | 2ef29cc320fdad9bca0d05ee2a43b70ac946b68f (diff) |
Dynamic buffer cache sizing.
This commit won't change the default behaviour of the system unless the
buffer cache size is increased with sysctl kern.bufcachepercent. By default
our buffer cache is 10% of memory, which with this commit is now treated
as a low water mark. If the buffer cache size is increased, the new size
is treated as a high water mark and the buffer cache is permitted to grow
to that percentage of memory.
If the page daemon is invoked, the page daemon will ask the buffer cache
to relenquish pages. if the buffer cache has more than the low water mark it
will relenquish pages allowing them to be consumed by uvm. after a short
period the buffer cache will attempt to re-grow back to the high water mark.
This permits the use of a large buffer cache without penalizing the available
memory for other purposes.
Above the low water mark the buffer cache remains entirely subservient to
the page daemon, so if uvm requires pages, the buffer cache will abandon
them.
ok art@ thib@ oga@
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 19112eff659..c1a0d54f5a1 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.170 2009/06/03 21:30:20 beck Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.171 2009/06/05 04:29:14 beck Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -548,7 +548,8 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, } if (bufcachepercent != opct) { pgs = bufcachepercent * physmem / 100; - bufadjust(pgs); + bufadjust(pgs); /* adjust bufpages */ + bufhighpages = bufpages; /* set high water mark */ } return(0); } |