Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_reserv.c
Show First 20 Lines • Show All 713 Lines • ▼ Show 20 Lines | if (first + maxpages > rightcap) { | ||||
*/ | */ | ||||
allocpages = minpages; | allocpages = minpages; | ||||
} | } | ||||
} | } | ||||
vm_reserv_object_unlock(object); | vm_reserv_object_unlock(object); | ||||
/* | /* | ||||
* Would the last new reservation extend past the end of the object? | * Would the last new reservation extend past the end of the object? | ||||
* | |||||
* If the object is unlikely to grow don't allocate a reservation for | |||||
* the tail. | |||||
*/ | */ | ||||
if (first + maxpages > object->size) { | if ((object->flags & OBJ_ANON) == 0 && | ||||
/* | first + maxpages > object->size) { | ||||
* Don't allocate the last new reservation if the object is a | |||||
* vnode or backed by another object that is a vnode. | |||||
*/ | |||||
if (object->type == OBJT_VNODE || | |||||
(object->backing_object != NULL && | |||||
object->backing_object->type == OBJT_VNODE)) { | |||||
if (maxpages == VM_LEVEL_0_NPAGES) | if (maxpages == VM_LEVEL_0_NPAGES) | ||||
return (NULL); | return (NULL); | ||||
allocpages = minpages; | allocpages = minpages; | ||||
} | } | ||||
/* Speculate that the object may grow. */ | |||||
} | |||||
/* | /* | ||||
* Allocate the physical pages. The alignment and boundary specified | * Allocate the physical pages. The alignment and boundary specified | ||||
* for this allocation may be different from the alignment and | * for this allocation may be different from the alignment and | ||||
* boundary specified for the requested pages. For instance, the | * boundary specified for the requested pages. For instance, the | ||||
* specified index may not be the first page within the first new | * specified index may not be the first page within the first new | ||||
* reservation. | * reservation. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | if (msucc != NULL) { | ||||
if (first + VM_LEVEL_0_NPAGES > rightcap) { | if (first + VM_LEVEL_0_NPAGES > rightcap) { | ||||
vm_reserv_object_unlock(object); | vm_reserv_object_unlock(object); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
} | } | ||||
vm_reserv_object_unlock(object); | vm_reserv_object_unlock(object); | ||||
/* | /* | ||||
* Would a new reservation extend past the end of the object? | * Would the last new reservation extend past the end of the object? | ||||
* | |||||
* If the object is unlikely to grow don't allocate a reservation for | |||||
* the tail. | |||||
*/ | */ | ||||
if (first + VM_LEVEL_0_NPAGES > object->size) { | if ((object->flags & OBJ_ANON) == 0 && | ||||
/* | first + VM_LEVEL_0_NPAGES > object->size) | ||||
* Don't allocate a new reservation if the object is a vnode or | |||||
* backed by another object that is a vnode. | |||||
*/ | |||||
if (object->type == OBJT_VNODE || | |||||
(object->backing_object != NULL && | |||||
object->backing_object->type == OBJT_VNODE)) | |||||
return (NULL); | return (NULL); | ||||
/* Speculate that the object may grow. */ | |||||
} | |||||
/* | /* | ||||
* Allocate and populate the new reservation. | * Allocate and populate the new reservation. | ||||
*/ | */ | ||||
m = NULL; | m = NULL; | ||||
vmd = VM_DOMAIN(domain); | vmd = VM_DOMAIN(domain); | ||||
if (vm_domain_allocate(vmd, req, 1)) { | if (vm_domain_allocate(vmd, req, 1)) { | ||||
vm_domain_free_lock(vmd); | vm_domain_free_lock(vmd); | ||||
▲ Show 20 Lines • Show All 528 Lines • Show Last 20 Lines |