diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-08-02 11:06:39 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-08-02 11:06:39 +0000 |
commit | c7a08faaa110b22ebee27cae896bbb58d550e019 (patch) | |
tree | 1c0d39b54e55545384e0e9f77864e0939276735a | |
parent | 05672db570577a60f1cd6c1230a487a68ca9b346 (diff) |
Sysctl for finding out how many pages there are in kmem_map.
-rw-r--r-- | sys/kern/kern_malloc.c | 6 | ||||
-rw-r--r-- | sys/sys/proc.h | 3 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 9 | ||||
-rw-r--r-- | sys/uvm/uvm_meter.c | 7 | ||||
-rw-r--r-- | sys/vm/vm_param.h | 6 |
5 files changed, 22 insertions, 9 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 68a943c5e23..8cfd6e52a65 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.36 2001/07/26 14:23:31 art Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.37 2001/08/02 11:06:38 art Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -52,6 +52,8 @@ static struct vm_map_intrsafe kmem_map_store; vm_map_t kmem_map = NULL; +int nkmempages; + struct kmembuckets bucket[MINBUCKET + 16]; struct kmemstats kmemstats[M_LAST]; struct kmemusage *kmemusage; @@ -451,6 +453,8 @@ kmeminit() #ifdef MALLOC_DEBUG debug_malloc_init(); #endif + + nkmempages = npg; } /* diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 34bc8d3d9fa..e7a8c19b2c8 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.45 2001/07/05 07:31:03 art Exp $ */ +/* $OpenBSD: proc.h,v 1.46 2001/08/02 11:06:38 art Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -374,7 +374,6 @@ void reaper __P((void)); void exit1 __P((struct proc *, int)); void exit2 __P((struct proc *)); int fork1 __P((struct proc *, int, int, void *, size_t, register_t *)); -void kmeminit __P((void)); void rqinit __P((void)); int groupmember __P((gid_t, struct ucred *)); void cpu_switch __P((struct proc *)); diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 27c9b941c64..94f7dc3fbcf 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_extern.h,v 1.15 2001/07/26 19:37:13 art Exp $ */ -/* $NetBSD: uvm_extern.h,v 1.36 2000/01/11 06:57:49 chs Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.16 2001/08/02 11:06:38 art Exp $ */ +/* $NetBSD: uvm_extern.h,v 1.37 2000/02/11 19:22:54 thorpej Exp $ */ /* * @@ -408,6 +408,11 @@ void uvm_vnp_terminate __P((struct vnode *)); boolean_t uvm_vnp_uncache __P((struct vnode *)); struct uvm_object *uvn_attach __P((void *, vm_prot_t)); +/* kern_malloc.c */ +void kmeminit_nkmempages __P((void)); +void kmeminit __P((void)); +extern int nkmempages; + #endif /* _KERNEL */ #endif /* _UVM_UVM_EXTERN_H_ */ diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c index c397087d7bb..e7eae692c65 100644 --- a/sys/uvm/uvm_meter.c +++ b/sys/uvm/uvm_meter.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_meter.c,v 1.10 2001/06/23 19:24:34 smart Exp $ */ -/* $NetBSD: uvm_meter.c,v 1.10 1999/07/25 06:30:36 thorpej Exp $ */ +/* $OpenBSD: uvm_meter.c,v 1.11 2001/08/02 11:06:38 art Exp $ */ +/* $NetBSD: uvm_meter.c,v 1.11 2000/02/11 19:22:54 thorpej Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -162,6 +162,9 @@ uvm_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) return (sysctl_rdstruct(oldp, oldlenp, newp, &uvmexp, sizeof(uvmexp))); + case VM_NKMEMPAGES: + return (sysctl_rdint(oldp, oldlenp, newp, nkmempages)); + case VM_PSSTRINGS: return (sysctl_rdstruct(oldp, oldlenp, newp, &_ps, sizeof(_ps))); diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index b1b037ed320..946b183bc39 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_param.h,v 1.22 2001/06/27 04:52:40 art Exp $ */ +/* $OpenBSD: vm_param.h,v 1.23 2001/08/02 11:06:38 art Exp $ */ /* $NetBSD: vm_param.h,v 1.12 1995/03/26 20:39:16 jtc Exp $ */ /* @@ -119,7 +119,8 @@ typedef int boolean_t; #define VM_PSSTRINGS 3 /* PSSTRINGS */ #define VM_UVMEXP 4 /* struct uvmexp */ #define VM_SWAPENCRYPT 5 /* int */ -#define VM_MAXID 6 /* number of valid vm ids */ +#define VM_NKMEMPAGES 6 /* int - # kmem_map pages */ +#define VM_MAXID 7 /* number of valid vm ids */ #define CTL_VM_NAMES { \ { 0, 0 }, \ @@ -128,6 +129,7 @@ typedef int boolean_t; { "psstrings", CTLTYPE_STRUCT }, \ { "uvmexp", CTLTYPE_STRUCT }, \ { "swapencrypt", CTLTYPE_NODE }, \ + { "nkmempages", CTLTYPE_INT }, \ } struct _ps_strings { |