Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_reserv.c
Show First 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | |||||
#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) | #define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) | ||||
#define vm_reserv_domain_scan_lock(d) mtx_lock(&vm_rvd[(d)].marker.lock) | #define vm_reserv_domain_scan_lock(d) mtx_lock(&vm_rvd[(d)].marker.lock) | ||||
#define vm_reserv_domain_scan_unlock(d) mtx_unlock(&vm_rvd[(d)].marker.lock) | #define vm_reserv_domain_scan_unlock(d) mtx_unlock(&vm_rvd[(d)].marker.lock) | ||||
static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"Reservation Info"); | "Reservation Info"); | ||||
static counter_u64_t vm_reserv_broken = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(vm_reserv_broken); | ||||
SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, | SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, broken, CTLFLAG_RD, | ||||
&vm_reserv_broken, "Cumulative number of broken reservations"); | &vm_reserv_broken, "Cumulative number of broken reservations"); | ||||
static counter_u64_t vm_reserv_freed = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(vm_reserv_freed); | ||||
SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, | SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, | ||||
&vm_reserv_freed, "Cumulative number of freed reservations"); | &vm_reserv_freed, "Cumulative number of freed reservations"); | ||||
static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); | static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); | ||||
SYSCTL_PROC(_vm_reserv, OID_AUTO, fullpop, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD, | SYSCTL_PROC(_vm_reserv, OID_AUTO, fullpop, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD, | ||||
NULL, 0, sysctl_vm_reserv_fullpop, "I", "Current number of full reservations"); | NULL, 0, sysctl_vm_reserv_fullpop, "I", "Current number of full reservations"); | ||||
static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS); | static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS); | ||||
SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, | SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, NULL, 0, | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, NULL, 0, | ||||
sysctl_vm_reserv_partpopq, "A", | sysctl_vm_reserv_partpopq, "A", | ||||
"Partially populated reservation queues"); | "Partially populated reservation queues"); | ||||
static counter_u64_t vm_reserv_reclaimed = EARLY_COUNTER; | static COUNTER_U64_DEFINE_EARLY(vm_reserv_reclaimed); | ||||
SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, | SYSCTL_COUNTER_U64(_vm_reserv, OID_AUTO, reclaimed, CTLFLAG_RD, | ||||
&vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); | &vm_reserv_reclaimed, "Cumulative number of reclaimed reservations"); | ||||
/* | /* | ||||
* The object lock pool is used to synchronize the rvq. We can not use a | * The object lock pool is used to synchronize the rvq. We can not use a | ||||
* pool mutex because it is required before malloc works. | * pool mutex because it is required before malloc works. | ||||
* | * | ||||
* The "hash" function could be made faster without divide and modulo. | * The "hash" function could be made faster without divide and modulo. | ||||
▲ Show 20 Lines • Show All 1,138 Lines • ▼ Show 20 Lines | vm_reserv_array = (void *)(uintptr_t)pmap_map(vaddr, new_end, end, | ||||
VM_PROT_READ | VM_PROT_WRITE); | VM_PROT_READ | VM_PROT_WRITE); | ||||
bzero(vm_reserv_array, size); | bzero(vm_reserv_array, size); | ||||
/* | /* | ||||
* Return the next available physical address. | * Return the next available physical address. | ||||
*/ | */ | ||||
return (new_end); | return (new_end); | ||||
} | } | ||||
/* | |||||
* Initializes the reservation management system. Specifically, initializes | |||||
* the reservation counters. | |||||
*/ | |||||
static void | |||||
vm_reserv_counter_init(void *unused) | |||||
{ | |||||
vm_reserv_freed = counter_u64_alloc(M_WAITOK); | |||||
vm_reserv_broken = counter_u64_alloc(M_WAITOK); | |||||
vm_reserv_reclaimed = counter_u64_alloc(M_WAITOK); | |||||
} | |||||
SYSINIT(vm_reserv_counter_init, SI_SUB_CPU, SI_ORDER_ANY, | |||||
vm_reserv_counter_init, NULL); | |||||
/* | /* | ||||
* Returns the superpage containing the given page. | * Returns the superpage containing the given page. | ||||
*/ | */ | ||||
vm_page_t | vm_page_t | ||||
vm_reserv_to_superpage(vm_page_t m) | vm_reserv_to_superpage(vm_page_t m) | ||||
{ | { | ||||
vm_reserv_t rv; | vm_reserv_t rv; | ||||
Show All 12 Lines |