Eliminate the counting of vm_page_pa_tryrelock calls. We really don't

need it anymore.  Moreover, its implementation had a type mismatch, a
long is not necessarily an uint64_t.  (This mismatch was hidden by
casting.)  Move the remaining two counters up a level in the sysctl
hierarchy.  There is no reason for them to be under the vm.pmap node.

Reviewed by:	kib
This commit is contained in:
alc 2011-01-08 22:45:22 +00:00
parent 26e5735cfb
commit a3f4c0274d

View File

@ -132,24 +132,6 @@ __FBSDID("$FreeBSD$");
#include <machine/md_var.h>
#if defined(__amd64__) || defined (__i386__)
extern struct sysctl_oid_list sysctl__vm_pmap_children;
#else
SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
#endif
static uint64_t pmap_tryrelock_calls;
SYSCTL_QUAD(_vm_pmap, OID_AUTO, tryrelock_calls, CTLFLAG_RD,
&pmap_tryrelock_calls, 0, "Number of tryrelock calls");
static int pmap_tryrelock_restart;
SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
&pmap_tryrelock_restart, 0, "Number of tryrelock restarts");
static int pmap_tryrelock_race;
SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_race, CTLFLAG_RD,
&pmap_tryrelock_race, 0, "Number of tryrelock pmap race cases");
/*
* Associated with page of user-allocatable memory is a
* page structure.
@ -171,6 +153,14 @@ TUNABLE_INT("vm.boot_pages", &boot_pages);
SYSCTL_INT(_vm, OID_AUTO, boot_pages, CTLFLAG_RD, &boot_pages, 0,
"number of pages allocated for bootstrapping the VM system");
static int pa_tryrelock_race;
SYSCTL_INT(_vm, OID_AUTO, tryrelock_race, CTLFLAG_RD,
&pa_tryrelock_race, 0, "Number of tryrelock race cases");
static int pa_tryrelock_restart;
SYSCTL_INT(_vm, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
&pa_tryrelock_restart, 0, "Number of tryrelock restarts");
static void vm_page_clear_dirty_mask(vm_page_t m, int pagebits);
static void vm_page_queue_remove(int queue, vm_page_t m);
static void vm_page_enqueue(int queue, vm_page_t m);
@ -195,7 +185,6 @@ vm_page_pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
uint32_t gen_count;
gen_count = pmap->pm_gen_count;
atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
lockpa = *locked;
*locked = pa;
if (lockpa) {
@ -207,13 +196,13 @@ vm_page_pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
if (PA_TRYLOCK(pa))
return (0);
PMAP_UNLOCK(pmap);
atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
atomic_add_int(&pa_tryrelock_restart, 1);
PA_LOCK(pa);
PMAP_LOCK(pmap);
if (pmap->pm_gen_count != gen_count + 1) {
pmap->pm_retries++;
atomic_add_int((volatile int *)&pmap_tryrelock_race, 1);
atomic_add_int(&pa_tryrelock_race, 1);
return (EAGAIN);
}
return (0);