Source-Changes-HG archive

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

[src/trunk]: src/sys/kern make accounting for vm_inuse sane



details:   https://anonhg.NetBSD.org/src/rev/6138b6555be3
branches:  trunk
changeset: 777784:6138b6555be3
user:      para <para%NetBSD.org@localhost>
date:      Sun Mar 04 14:28:49 2012 +0000

description:
make accounting for vm_inuse sane
while here don't statically allocated for more caches then required

diffstat:

 sys/kern/subr_vmem.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 2c35d7fd83e4 -r 6138b6555be3 sys/kern/subr_vmem.c
--- a/sys/kern/subr_vmem.c      Sun Mar 04 11:58:31 2012 +0000
+++ b/sys/kern/subr_vmem.c      Sun Mar 04 14:28:49 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_vmem.c,v 1.72 2012/02/10 17:35:47 para Exp $      */
+/*     $NetBSD: subr_vmem.c,v 1.73 2012/03/04 14:28:49 para Exp $      */
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.72 2012/02/10 17:35:47 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.73 2012/03/04 14:28:49 para Exp $");
 
 #if defined(_KERNEL)
 #include "opt_ddb.h"
@@ -248,7 +248,8 @@
 #define BT_MAXFREE 64
 #define STATIC_VMEM_COUNT 5
 #define STATIC_BT_COUNT 200
-#define STATIC_QC_POOL_COUNT (VMEM_QCACHE_IDX_MAX + 1)
+/* must be equal or greater then qcache multiplier for kmem_va_arena */
+#define STATIC_QC_POOL_COUNT 8
 
 static struct vmem static_vmems[STATIC_VMEM_COUNT];
 static int static_vmem_count = STATIC_VMEM_COUNT;
@@ -474,6 +475,7 @@
 {
 
        KASSERT(vm->vm_nbusytag > 0);
+       vm->vm_inuse -= bt->bt_size;
        vm->vm_nbusytag--;
        LIST_REMOVE(bt, bt_hashlist);
 }
@@ -488,6 +490,7 @@
        list = bt_hashhead(vm, bt->bt_start);
        LIST_INSERT_HEAD(list, bt, bt_hashlist);
        vm->vm_nbusytag++;
+       vm->vm_inuse += bt->bt_size;
 }
 
 /* ---- boundary tag list */
@@ -1265,7 +1268,6 @@
        KASSERT(bt->bt_size >= size);
        bt_remfree(vm, bt);
        vmem_check(vm);
-       vm->vm_inuse += size;
        if (bt->bt_start != start) {
                btnew2->bt_type = BT_TYPE_FREE;
                btnew2->bt_start = bt->bt_start;
@@ -1357,8 +1359,6 @@
        bt_rembusy(vm, bt);
        bt->bt_type = BT_TYPE_FREE;
 
-       vm->vm_inuse -= bt->bt_size;
-
        /* coalesce */
        t = CIRCLEQ_NEXT(bt, bt_seglist);
        if (t != NULL && t->bt_type == BT_TYPE_FREE) {



Home | Main Index | Thread Index | Old Index