Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_reserv.c
Show First 20 Lines • Show All 587 Lines • ▼ Show 20 Lines | vm_reserv_extend_contig(int req, vm_object_t object, vm_pindex_t pindex, | ||||
for (i = 0; i < npages; i++) { | for (i = 0; i < npages; i++) { | ||||
if (popmap_is_set(rv->popmap, index + i)) { | if (popmap_is_set(rv->popmap, index + i)) { | ||||
m = NULL; | m = NULL; | ||||
goto out; | goto out; | ||||
} | } | ||||
} | } | ||||
for (i = 0; i < npages; i++) | for (i = 0; i < npages; i++) | ||||
vm_reserv_populate(rv, index + i); | vm_reserv_populate(rv, index + i); | ||||
vm_domain_freecnt_adj(vmd, -npages); | vm_domain_freecnt_dec(vmd, npages); | ||||
out: | out: | ||||
vm_domain_free_unlock(vmd); | vm_domain_free_unlock(vmd); | ||||
return (m); | return (m); | ||||
} | } | ||||
/* | /* | ||||
* Allocates a contiguous set of physical pages of the given size "npages" | * Allocates a contiguous set of physical pages of the given size "npages" | ||||
* from newly created reservations. All of the physical pages | * from newly created reservations. All of the physical pages | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
vm_page_t | vm_page_t | ||||
vm_reserv_extend(int req, vm_object_t object, vm_pindex_t pindex, int domain, | vm_reserv_extend(int req, vm_object_t object, vm_pindex_t pindex, int domain, | ||||
vm_page_t mpred) | vm_page_t mpred) | ||||
{ | { | ||||
struct vm_domain *vmd; | struct vm_domain *vmd; | ||||
vm_page_t m, msucc; | vm_page_t m, msucc; | ||||
vm_reserv_t rv; | vm_reserv_t rv; | ||||
int index, free_count; | int index; | ||||
VM_OBJECT_ASSERT_WLOCKED(object); | VM_OBJECT_ASSERT_WLOCKED(object); | ||||
/* | /* | ||||
* Could a reservation currently exist? | * Could a reservation currently exist? | ||||
*/ | */ | ||||
if (pindex < VM_RESERV_INDEX(object, pindex) || | if (pindex < VM_RESERV_INDEX(object, pindex) || | ||||
pindex >= object->size || object->resident_page_count == 0) | pindex >= object->size || object->resident_page_count == 0) | ||||
Show All 16 Lines | vm_reserv_extend(int req, vm_object_t object, vm_pindex_t pindex, int domain, | ||||
if (vm_domain_available(vmd, req, 1) == 0 || | if (vm_domain_available(vmd, req, 1) == 0 || | ||||
/* Handle reclaim race. */ | /* Handle reclaim race. */ | ||||
rv->object != object || | rv->object != object || | ||||
/* Handle vm_page_rename(m, new_object, ...). */ | /* Handle vm_page_rename(m, new_object, ...). */ | ||||
popmap_is_set(rv->popmap, index)) | popmap_is_set(rv->popmap, index)) | ||||
m = NULL; | m = NULL; | ||||
if (m != NULL) { | if (m != NULL) { | ||||
vm_reserv_populate(rv, index); | vm_reserv_populate(rv, index); | ||||
free_count = vm_domain_freecnt_adj(vmd, -1); | vm_domain_freecnt_dec(vmd, 1); | ||||
} else | } | ||||
free_count = vmd->vmd_free_count; | |||||
vm_domain_free_unlock(vmd); | vm_domain_free_unlock(vmd); | ||||
if (vm_paging_needed(vmd, free_count)) | |||||
pagedaemon_wakeup(domain); | |||||
return (m); | return (m); | ||||
} | } | ||||
/* | /* | ||||
* Attempts to allocate a new reservation for the object, and allocates a | * Attempts to allocate a new reservation for the object, and allocates a | ||||
* page from that reservation. Callers should first invoke vm_reserv_extend() | * page from that reservation. Callers should first invoke vm_reserv_extend() | ||||
* to attempt an allocation from an existing reservation. | * to attempt an allocation from an existing reservation. | ||||
▲ Show 20 Lines • Show All 524 Lines • Show Last 20 Lines |