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
This commit is contained in:
Andriy Gapon 2010-10-07 18:11:33 +00:00
parent 68f7a01392
commit 7814c80a5b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213527

View File

@ -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.