Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Users have observed that the amount of memory used ...



details:   https://anonhg.NetBSD.org/src/rev/70786e6cc995
branches:  trunk
changeset: 572697:70786e6cc995
user:      tls <tls%NetBSD.org@localhost>
date:      Mon Jan 10 15:29:50 2005 +0000

description:
Users have observed that the amount of memory used by the metadata cache
can in some situations exceed the high-water mark, and stay there once it
gets there.  Adjust the canrelease function so that it will immediately
bring us back down to the high-water mark in this situation.

How can this happen at all?  Consider a machine with two filesystems, one
with a much larger blocksize than the other.  If the small-block filesystem
is very busy, growing the cache up to the high-water mark, and then the
large-block filesystem becomes busy, buffers will be recycled (since we
are at the high-water mark) but _grow each time they're recycled_.  Once
we're above the high-water mark, the canrelease call in allocbuf (without
this change) doesn't shrink us back down below it; so things get worse and
worse.

diffstat:

 sys/kern/vfs_bio.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r c86e237f2337 -r 70786e6cc995 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Mon Jan 10 14:10:32 2005 +0000
+++ b/sys/kern/vfs_bio.c        Mon Jan 10 15:29:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.140 2004/12/23 20:11:28 dbj Exp $        */
+/*     $NetBSD: vfs_bio.c,v 1.141 2005/01/10 15:29:50 tls Exp $        */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -81,7 +81,7 @@
 #include "opt_softdep.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.140 2004/12/23 20:11:28 dbj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.141 2005/01/10 15:29:50 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -487,6 +487,9 @@
        if (bufmem < bufmem_lowater)
                return 0;
 
+       if (bufmem > bufmem_hiwater)
+               return bufmem - bufmem_hiwater;
+
        ninvalid += bufqueues[BQ_AGE].bq_bytes;
 
        pagedemand = uvmexp.freetarg - uvmexp.free;



Home | Main Index | Thread Index | Old Index