svn commit: r213527 - head/sys/kern
Andriy Gapon
avg at FreeBSD.org
Thu Oct 7 18:11:33 UTC 2010
Author: avg
Date: Thu Oct 7 18:11:33 2010
New Revision: 213527
URL: http://svn.freebsd.org/changeset/base/213527
Log:
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
Modified:
head/sys/kern/kern_malloc.c
Modified: head/sys/kern/kern_malloc.c
==============================================================================
--- head/sys/kern/kern_malloc.c Thu Oct 7 18:00:55 2010 (r213526)
+++ head/sys/kern/kern_malloc.c Thu Oct 7 18:11:33 2010 (r213527)
@@ -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, fail
&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.
More information about the svn-src-head
mailing list