Changeset View
Changeset View
Standalone View
Standalone View
vm/vm_reserv.c
Context not available. | |||||
} | } | ||||
/* | /* | ||||
* Returns true if the given page belongs to a reservation and that page is | |||||
* free. Otherwise, returns false. | |||||
*/ | |||||
bool | |||||
vm_reserv_is_page_free(vm_page_t m) | |||||
{ | |||||
vm_reserv_t rv; | |||||
mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); | |||||
rv = vm_reserv_from_page(m); | |||||
if (rv->object == NULL) | |||||
return (false); | |||||
return (popmap_is_clear(rv->popmap, m - rv->pages)); | |||||
} | |||||
/* | |||||
* If the given page belongs to a reservation, returns the level of that | |||||
* reservation. Otherwise, returns -1. | |||||
*/ | |||||
int | |||||
vm_reserv_level(vm_page_t m) | |||||
{ | |||||
vm_reserv_t rv; | |||||
rv = vm_reserv_from_page(m); | |||||
return (rv->object != NULL ? 0 : -1); | |||||
} | |||||
/* | |||||
* Returns a reservation level if the given page belongs to a fully-populated | * Returns a reservation level if the given page belongs to a fully-populated | ||||
* reservation and -1 otherwise. | * reservation and -1 otherwise. | ||||
*/ | */ | ||||
Context not available. | |||||
} | } | ||||
/* | /* | ||||
* Returns the size (in bytes) of a reservation of the specified level. | |||||
*/ | |||||
int | |||||
vm_reserv_size(int level) | |||||
{ | |||||
switch (level) { | |||||
case 0: | |||||
return (VM_LEVEL_0_SIZE); | |||||
case -1: | |||||
return (PAGE_SIZE); | |||||
default: | |||||
return (0); | |||||
} | |||||
} | |||||
/* | |||||
* Allocates the virtual and physical memory required by the reservation | * Allocates the virtual and physical memory required by the reservation | ||||
* management system's data structures, in particular, the reservation array. | * management system's data structures, in particular, the reservation array. | ||||
*/ | */ | ||||
Context not available. |