Add sysctl hw.uma_mdpages to track how many pages have been allocated

by UMA_MD_SMALL_ALLOC
This commit is contained in:
Peter Grehan 2004-02-11 04:42:48 +00:00
parent 1922fd129e
commit 7d23b5b7db
2 changed files with 18 additions and 0 deletions

View File

@ -28,9 +28,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
@ -38,6 +40,10 @@ __FBSDID("$FreeBSD$");
#include <vm/uma_int.h>
#include <machine/vmparam.h>
static int hw_uma_mdpages;
SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, CTLFLAG_RD, &hw_uma_mdpages, 0,
"UMA MD pages in use");
void *
uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
{
@ -67,6 +73,8 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
va = (void *) VM_PAGE_TO_PHYS(m);
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
bzero(va, PAGE_SIZE);
atomic_add_int(&hw_uma_mdpages, 1);
return (va);
}
@ -79,4 +87,5 @@ uma_small_free(void *mem, int size, u_int8_t flags)
vm_page_lock_queues();
vm_page_free(m);
vm_page_unlock_queues();
atomic_subtract_int(&hw_uma_mdpages, 1);
}

View File

@ -28,9 +28,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
@ -38,6 +40,10 @@ __FBSDID("$FreeBSD$");
#include <vm/uma_int.h>
#include <machine/vmparam.h>
static int hw_uma_mdpages;
SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, CTLFLAG_RD, &hw_uma_mdpages, 0,
"UMA MD pages in use");
void *
uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
{
@ -67,6 +73,8 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
va = (void *) VM_PAGE_TO_PHYS(m);
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
bzero(va, PAGE_SIZE);
atomic_add_int(&hw_uma_mdpages, 1);
return (va);
}
@ -79,4 +87,5 @@ uma_small_free(void *mem, int size, u_int8_t flags)
vm_page_lock_queues();
vm_page_free(m);
vm_page_unlock_queues();
atomic_subtract_int(&hw_uma_mdpages, 1);
}