diff options
author | avg <avg@FreeBSD.org> | 2010-10-07 18:11:33 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2010-10-07 18:11:33 +0000 |
commit | 7010764d95d1e14fa58744c9671c2a8b0abadee4 (patch) | |
tree | bf223a828779a65e413aa6c2fc02175ab3aea21f /sys/kern | |
parent | d93ad5245d40e2887d36fe6e876a870d16f1dc0d (diff) | |
download | FreeBSD-src-7010764d95d1e14fa58744c9671c2a8b0abadee4.zip FreeBSD-src-7010764d95d1e14fa58744c9671c2a8b0abadee4.tar.gz |
vm.kmem_map_size: a sysctl to query current kmem_map->size
Based on a patch from Sandvine Incorporated via emaste.
Reviewed by: emaste
MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_malloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index d913ccf..ee45e3a 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -202,6 +202,11 @@ static u_int vm_kmem_size_scale; SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, &vm_kmem_size_scale, 0, "Scale factor for kernel memory size"); +static int sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm, OID_AUTO, kmem_map_size, + CTLFLAG_RD | CTLTYPE_ULONG | CTLFLAG_MPSAFE, NULL, 0, + sysctl_kmem_map_size, "LU", "Current kmem_map allocation size"); + /* * The malloc_mtx protects the kmemstatistics linked list. */ @@ -240,6 +245,15 @@ SYSCTL_INT(_debug_malloc, OID_AUTO, failure_count, CTLFLAG_RD, &malloc_failure_count, 0, "Number of imposed M_NOWAIT malloc failures"); #endif +static int +sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS) +{ + u_long size; + + size = kmem_map->size; + return (sysctl_handle_long(oidp, &size, 0, req)); +} + /* * malloc(9) uma zone separation -- sub-page buffer overruns in one * malloc type will affect only a subset of other malloc types. |