Add sysctl hw.uma_mdpages to track how many pages have been allocated
by UMA_MD_SMALL_ALLOC
This commit is contained in:
parent
1922fd129e
commit
7d23b5b7db
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user