Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_map.c
Context not available. | |||||
static inline void | static inline void | ||||
vm_map_entry_set_max_free(vm_map_entry_t entry) | vm_map_entry_set_max_free(vm_map_entry_t entry) | ||||
{ | { | ||||
vm_map_entry_t child; | vm_map_entry_t child; | ||||
vm_size_t max_left, max_right; | vm_size_t max_left, max_right; | ||||
kib: vm_map_maxfree_left, please honor the symbols namespace. | |||||
child = entry->left; | child = entry->left; | ||||
max_left = (child != NULL) ? child->max_free : | max_left = (child != NULL) ? child->max_free : | ||||
Done Inline ActionsThese functions operate on entries. Why has "entry_" been removed from the function name? alc: These functions operate on entries. Why has "entry_" been removed from the function name? | |||||
Done Inline ActionsBecause 80-character line limits and 8-space tabs make people desperate to avoid long names and nested loops. Neverthless, at the cost of wrapping 2 long lines, this has been changed. dougm: Because 80-character line limits and 8-space tabs make people desperate to avoid long names and… | |||||
entry->start - entry->prev->end; | entry->start - entry->prev->end; | ||||
child = entry->right; | child = entry->right; | ||||
Done Inline ActionsBlank line between functions definitions. kib: Blank line between functions definitions. | |||||
max_right = (child != NULL) ? child->max_free : | max_right = (child != NULL) ? child->max_free : | ||||
Done Inline Actionsnamespace. kib: namespace. | |||||
entry->next->start - entry->end; | entry->next->start - entry->end; | ||||
entry->max_free = MAX(max_left, max_right); | entry->max_free = MAX(max_left, max_right); | ||||
} | } | ||||
Done Inline Actionsvm_size_t, not size_t. alc: vm_size_t, not size_t. | |||||
#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ | #define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ | ||||
y = root->left; \ | y = root->left; \ | ||||
if (y != NULL && (test)) { \ | if (y != NULL && (test)) { \ | ||||
Done Inline ActionsInsert blank line. alc: Insert blank line. | |||||
/* Rotate right and make y root. */ \ | /* Rotate right and make y root. */ \ | ||||
root->left = y->right; \ | root->left = y->right; \ | ||||
y->right = root; \ | y->right = root; \ | ||||
vm_map_entry_set_max_free(root); \ | if (root->max_free == y->max_free) \ | ||||
Done Inline ActionsDitto. alc: Ditto. | |||||
root = y; \ | vm_map_entry_set_max_free(root); \ | ||||
y = root->left; \ | root = y; \ | ||||
} \ | y = root->left; \ | ||||
Done Inline ActionsInsert blank line. alc: Insert blank line. | |||||
/* Put root on rlist. */ \ | } \ | ||||
root->left = rlist; \ | /* Put root on rlist. */ \ | ||||
rlist = root; \ | root->left = rlist; \ | ||||
root = y; \ | rlist = root; \ | ||||
root = y; \ | |||||
/* Make rlist->max_free match max_free for its right child. */ \ | |||||
y = rlist->right; \ | |||||
rlist->max_free = (y != NULL) ? \ | |||||
y->max_free : rlist->next->start - rlist->end; \ | |||||
} while (0) | } while (0) | ||||
#define SPLAY_RIGHT_STEP(root, y, llist, test) do { \ | #define SPLAY_RIGHT_STEP(root, y, llist, test) do { \ | ||||
y = root->right; \ | y = root->right; \ | ||||
if (y != NULL && (test)) { \ | if (y != NULL && (test)) { \ | ||||
/* Rotate left and make y root. */ \ | /* Rotate left and make y root. */ \ | ||||
root->right = y->left; \ | root->right = y->left; \ | ||||
y->left = root; \ | y->left = root; \ | ||||
vm_map_entry_set_max_free(root); \ | if (root->max_free == y->max_free) \ | ||||
root = y; \ | vm_map_entry_set_max_free(root); \ | ||||
y = root->right; \ | root = y; \ | ||||
} \ | y = root->right; \ | ||||
/* Put root on llist. */ \ | } \ | ||||
root->right = llist; \ | /* Put root on llist. */ \ | ||||
llist = root; \ | root->right = llist; \ | ||||
root = y; \ | llist = root; \ | ||||
root = y; \ | |||||
/* Make llist->max_free match max_free for its left child. */ \ | |||||
y = llist->left; \ | |||||
llist->max_free = (y != NULL) ? \ | |||||
y->max_free : llist->start - llist->prev->end; \ | |||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Walk down the tree until we find addr or a NULL pointer where addr would go, | * Walk down the tree until we find addr or a NULL pointer where addr would go, | ||||
* breaking off left and right subtrees of nodes less than, or greater than | * breaking off left and right subtrees of nodes less than, or greater than | ||||
* addr. Treat pointers to nodes with max_free < length as NULL pointers. | * addr. Treat pointers to nodes with max_free < length as NULL pointers. | ||||
* llist and rlist are the two sides in reverse order (bottom-up), with llist | * llist and rlist are the two sides in reverse order (bottom-up), with llist | ||||
* linked by the right pointer and rlist linked by the left pointer in the | * linked by the right pointer and rlist linked by the left pointer in the | ||||
Show All 14 Lines | |||||
* subtrees of the root go at the bottom of llist and rlist. | * subtrees of the root go at the bottom of llist and rlist. | ||||
*/ | */ | ||||
static vm_map_entry_t | static vm_map_entry_t | ||||
vm_map_splay_merge(vm_map_entry_t root, | vm_map_splay_merge(vm_map_entry_t root, | ||||
vm_map_entry_t llist, vm_map_entry_t rlist, | vm_map_entry_t llist, vm_map_entry_t rlist, | ||||
vm_map_entry_t ltree, vm_map_entry_t rtree) | vm_map_entry_t ltree, vm_map_entry_t rtree) | ||||
{ | { | ||||
vm_map_entry_t y; | vm_map_entry_t y; | ||||
vm_size_t max_free; | |||||
if (llist != NULL) | |||||
max_free = (ltree != NULL) ? ltree->max_free : | |||||
llist->next->start - llist->end; | |||||
while (llist != NULL) { | while (llist != NULL) { | ||||
y = llist->right; | y = llist->right; | ||||
llist->right = ltree; | llist->right = ltree; | ||||
vm_map_entry_set_max_free(llist); | if (llist->max_free < max_free) | ||||
llist->max_free = max_free; | |||||
else | |||||
max_free = llist->max_free; | |||||
ltree = llist; | ltree = llist; | ||||
llist = y; | llist = y; | ||||
} | } | ||||
if (rlist != NULL) | |||||
max_free = (rtree != NULL) ? rtree->max_free : | |||||
rlist->start - rlist->prev->end; | |||||
while (rlist != NULL) { | while (rlist != NULL) { | ||||
y = rlist->left; | y = rlist->left; | ||||
rlist->left = rtree; | rlist->left = rtree; | ||||
vm_map_entry_set_max_free(rlist); | if (rlist->max_free < max_free) | ||||
rlist->max_free = max_free; | |||||
else | |||||
max_free = rlist->max_free; | |||||
rtree = rlist; | rtree = rlist; | ||||
rlist = y; | rlist = y; | ||||
} | } | ||||
/* | /* | ||||
* Final assembly: add ltree and rtree as subtrees of root. | * Final assembly: add ltree and rtree as subtrees of root. | ||||
*/ | */ | ||||
root->left = ltree; | root->left = ltree; | ||||
root->right = rtree; | root->right = rtree; | ||||
vm_map_entry_set_max_free(root); | vm_map_entry_set_max_free(root); | ||||
return (root); | return (root); | ||||
} | } | ||||
/* | /* | ||||
Done Inline ActionsWith this change, I would have expected the removal of entry_ from the function's name. In general, there is increasing inconsistency in the use of vm_map_entry_ versus vm_map_. alc: With this change, I would have expected the removal of entry_ from the function's name. In… | |||||
Context not available. | |||||
/* | /* | ||||
* vm_map_entry_{un,}link: | * vm_map_entry_{un,}link: | ||||
* | * | ||||
* Insert/remove entries from maps. | * Insert/remove entries from maps. | ||||
*/ | */ | ||||
static void | static void | ||||
vm_map_entry_link(vm_map_t map, | vm_map_entry_link(vm_map_t map, | ||||
vm_map_entry_t entry) | vm_map_entry_t entry) | ||||
{ | { | ||||
vm_map_entry_t llist, rlist, root; | vm_map_entry_t llist, rlist, root; | ||||
CTR3(KTR_VM, | CTR3(KTR_VM, | ||||
"vm_map_entry_link: map %p, nentries %d, entry %p", map, | "vm_map_entry_link: map %p, nentries %d, entry %p", map, | ||||
map->nentries, entry); | map->nentries, entry); | ||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
// VM_MAP_ASSERT_CONSISTENT(map); | |||||
map->nentries++; | map->nentries++; | ||||
root = map->root; | root = map->root; | ||||
root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | ||||
KASSERT(root == NULL, | KASSERT(root == NULL, | ||||
("vm_map_entry_link: link object already mapped")); | ("vm_map_entry_link: link object already mapped")); | ||||
entry->prev = (llist == NULL) ? &map->header : llist; | entry->prev = (llist == NULL) ? &map->header : llist; | ||||
entry->next = (rlist == NULL) ? &map->header : rlist; | entry->next = (rlist == NULL) ? &map->header : rlist; | ||||
entry->prev->next = entry->next->prev = entry; | entry->prev->next = entry->next->prev = entry; | ||||
Show All 9 Lines | |||||
}; | }; | ||||
static void | static void | ||||
vm_map_entry_unlink(vm_map_t map, | vm_map_entry_unlink(vm_map_t map, | ||||
vm_map_entry_t entry, | vm_map_entry_t entry, | ||||
enum unlink_merge_type op) | enum unlink_merge_type op) | ||||
{ | { | ||||
vm_map_entry_t llist, rlist, root, y; | vm_map_entry_t llist, rlist, root, y; | ||||
Done Inline ActionsUnnecessary parentheses. alc: Unnecessary parentheses. | |||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
llist = entry->prev; | |||||
rlist = entry->next; | |||||
llist->next = rlist; | |||||
rlist->prev = llist; | |||||
root = map->root; | root = map->root; | ||||
root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | ||||
Done Inline ActionsIncorrect indentation. alc: Incorrect indentation. | |||||
KASSERT(root != NULL, | KASSERT(root != NULL, | ||||
("vm_map_entry_unlink: unlink object not mapped")); | ("vm_map_entry_unlink: unlink object not mapped")); | ||||
switch (op) { | switch (op) { | ||||
case UNLINK_MERGE_PREV: | case UNLINK_MERGE_PREV: | ||||
vm_map_splay_findprev(root, &llist); | vm_map_splay_findprev(root, &llist); | ||||
llist->end = root->end; | llist->end = root->end; | ||||
y = root->right; | y = root->right; | ||||
Show All 12 Lines | |||||
} else if (rlist != NULL) { | } else if (rlist != NULL) { | ||||
root = rlist; | root = rlist; | ||||
rlist = root->left; | rlist = root->left; | ||||
root->left = NULL; | root->left = NULL; | ||||
} else | } else | ||||
root = NULL; | root = NULL; | ||||
break; | break; | ||||
} | } | ||||
y = entry->next; | |||||
y->prev = entry->prev; | |||||
y->prev->next = y; | |||||
if (root != NULL) | if (root != NULL) | ||||
root = vm_map_splay_merge(root, llist, rlist, | root = vm_map_splay_merge(root, llist, rlist, | ||||
root->left, root->right); | root->left, root->right); | ||||
map->root = root; | map->root = root; | ||||
VM_MAP_ASSERT_CONSISTENT(map); | VM_MAP_ASSERT_CONSISTENT(map); | ||||
map->nentries--; | map->nentries--; | ||||
CTR3(KTR_VM, "vm_map_entry_unlink: map %p, nentries %d, entry %p", map, | CTR3(KTR_VM, "vm_map_entry_unlink: map %p, nentries %d, entry %p", map, | ||||
map->nentries, entry); | map->nentries, entry); | ||||
} | } | ||||
/* | /* | ||||
* vm_map_entry_resize_free: | * vm_map_entry_resize_free: | ||||
* | * | ||||
* Recompute the amount of free space following a modified vm_map_entry | * Recompute the amount of free space around a modified vm_map_entry and | ||||
* and propagate those values up the tree. Call this function after | * propagate those values up the tree. Call this function to resizing a | ||||
* resizing a map entry in-place by changing the end value, without a | * map entry in-place by changing the start and end values, without a | ||||
* call to vm_map_entry_link() or _unlink(). | * call to vm_map_entry_link() or _unlink(). | ||||
* | * | ||||
* The map must be locked, and leaves it so. | * The map must be locked, and leaves it so. | ||||
*/ | */ | ||||
static void | static void | ||||
vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t entry) | vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t entry, | ||||
vm_offset_t start, vm_map_offset end) | |||||
{ | { | ||||
vm_map_entry_t llist, rlist, root; | vm_map_entry_t llist, rlist, root; | ||||
VM_MAP_ASSERT_LOCKED(map); | VM_MAP_ASSERT_LOCKED(map); | ||||
root = map->root; | root = map->root; | ||||
root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); | ||||
KASSERT(root != NULL, | KASSERT(root != NULL, | ||||
("vm_map_entry_resize_free: resize_free object not mapped")); | ("vm_map_entry_resize_free: resize_free object not mapped")); | ||||
vm_map_splay_findnext(root, &rlist); | if (entry->start != start) { | ||||
root->right = NULL; | vm_map_splay_findprev(root, &llist); | ||||
root->left = NULL; | |||||
entry->start = start; | |||||
} | |||||
if (entry->end != end) { | |||||
vm_map_splay_findnext(root, &rlist); | |||||
root->right = NULL; | |||||
entry->end = end; | |||||
} | |||||
map->root = vm_map_splay_merge(root, llist, rlist, | map->root = vm_map_splay_merge(root, llist, rlist, | ||||
root->left, root->right); | root->left, root->right); | ||||
VM_MAP_ASSERT_CONSISTENT(map); | VM_MAP_ASSERT_CONSISTENT(map); | ||||
CTR3(KTR_VM, "vm_map_entry_resize_free: map %p, nentries %d, entry %p", map, | CTR3(KTR_VM, "vm_map_entry_resize_free: map %p, nentries %d, entry %p", map, | ||||
map->nentries, entry); | map->nentries, entry); | ||||
} | } | ||||
/* | /* | ||||
Show All 14 Lines | |||||
if ((locked = vm_map_locked(map)) || | if ((locked = vm_map_locked(map)) || | ||||
sx_try_upgrade(&map->lock)) { | sx_try_upgrade(&map->lock)) { | ||||
/* | /* | ||||
* Splay requires a write lock on the map. However, it only | * Splay requires a write lock on the map. However, it only | ||||
* restructures the binary search tree; it does not otherwise | * restructures the binary search tree; it does not otherwise | ||||
* change the map. Thus, the map's timestamp need not change | * change the map. Thus, the map's timestamp need not change | ||||
* on a temporary upgrade. | * on a temporary upgrade. | ||||
*/ | */ | ||||
VM_MAP_ASSERT_CONSISTENT(map); | |||||
map->root = cur = vm_map_entry_splay(address, cur); | map->root = cur = vm_map_entry_splay(address, cur); | ||||
VM_MAP_ASSERT_CONSISTENT(map); | VM_MAP_ASSERT_CONSISTENT(map); | ||||
if (!locked) | if (!locked) | ||||
sx_downgrade(&map->lock); | sx_downgrade(&map->lock); | ||||
/* | /* | ||||
* If "address" is contained within a map entry, the new root | * If "address" is contained within a map entry, the new root | ||||
* is that map entry. Otherwise, the new root is a map entry | * is that map entry. Otherwise, the new root is a map entry | ||||
Show All 14 Lines | |||||
prev_entry->protection == prot && | prev_entry->protection == prot && | ||||
prev_entry->max_protection == max && | prev_entry->max_protection == max && | ||||
prev_entry->wired_count == 0) { | prev_entry->wired_count == 0) { | ||||
KASSERT((prev_entry->eflags & MAP_ENTRY_USER_WIRED) == | KASSERT((prev_entry->eflags & MAP_ENTRY_USER_WIRED) == | ||||
0, ("prev_entry %p has incoherent wiring", | 0, ("prev_entry %p has incoherent wiring", | ||||
prev_entry)); | prev_entry)); | ||||
if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) | if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) | ||||
map->size += end - prev_entry->end; | map->size += end - prev_entry->end; | ||||
prev_entry->end = end; | vm_map_entry_resize_free(map, prev_entry, | ||||
vm_map_entry_resize_free(map, prev_entry); | prev_entry->start, end); | ||||
vm_map_simplify_entry(map, prev_entry); | vm_map_simplify_entry(map, prev_entry); | ||||
return (KERN_SUCCESS); | return (KERN_SUCCESS); | ||||
} | } | ||||
/* | /* | ||||
* If we can extend the object but cannot extend the | * If we can extend the object but cannot extend the | ||||
* map entry, we have to create a new map entry. We | * map entry, we have to create a new map entry. We | ||||
* must bump the ref count on the extended object to | * must bump the ref count on the extended object to | ||||
Show All 14 Lines | |||||
entry->cred = NULL; | entry->cred = NULL; | ||||
} | } | ||||
new_entry = vm_map_entry_create(map); | new_entry = vm_map_entry_create(map); | ||||
*new_entry = *entry; | *new_entry = *entry; | ||||
new_entry->end = start; | new_entry->end = start; | ||||
entry->offset += (start - entry->start); | entry->offset += (start - entry->start); | ||||
entry->start = start; | vm_map_entry_resize_free(map, entry, start, entry->end); | ||||
if (new_entry->cred != NULL) | if (new_entry->cred != NULL) | ||||
crhold(entry->cred); | crhold(entry->cred); | ||||
vm_map_entry_link(map, new_entry); | vm_map_entry_link(map, new_entry); | ||||
if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { | if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { | ||||
vm_object_reference(new_entry->object.vm_object); | vm_object_reference(new_entry->object.vm_object); | ||||
/* | /* | ||||
Show All 14 Lines | |||||
} | } | ||||
/* | /* | ||||
* Create a new entry and insert it AFTER the specified entry | * Create a new entry and insert it AFTER the specified entry | ||||
*/ | */ | ||||
new_entry = vm_map_entry_create(map); | new_entry = vm_map_entry_create(map); | ||||
*new_entry = *entry; | *new_entry = *entry; | ||||
new_entry->start = entry->end = end; | vm_map_entry_resize_free(map, entry, entry->start, end); | ||||
new_entry->start = end; | |||||
new_entry->offset += (end - entry->start); | new_entry->offset += (end - entry->start); | ||||
if (new_entry->cred != NULL) | if (new_entry->cred != NULL) | ||||
crhold(entry->cred); | crhold(entry->cred); | ||||
vm_map_entry_link(map, new_entry); | vm_map_entry_link(map, new_entry); | ||||
if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { | if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { | ||||
vm_object_reference(new_entry->object.vm_object); | vm_object_reference(new_entry->object.vm_object); | ||||
Show All 14 Lines | |||||
grow_start = gap_entry->end - grow_amount; | grow_start = gap_entry->end - grow_amount; | ||||
if (gap_entry->start + grow_amount == gap_entry->end) { | if (gap_entry->start + grow_amount == gap_entry->end) { | ||||
gap_start = gap_entry->start; | gap_start = gap_entry->start; | ||||
gap_end = gap_entry->end; | gap_end = gap_entry->end; | ||||
vm_map_entry_delete(map, gap_entry); | vm_map_entry_delete(map, gap_entry); | ||||
gap_deleted = true; | gap_deleted = true; | ||||
} else { | } else { | ||||
MPASS(gap_entry->start < gap_entry->end - grow_amount); | MPASS(gap_entry->start < gap_entry->end - grow_amount); | ||||
gap_entry->end -= grow_amount; | vm_map_entry_resize_free(map, gap_entry, | ||||
vm_map_entry_resize_free(map, gap_entry); | gap_entry->start, gap_entry->end - grow_amount); | ||||
gap_deleted = false; | gap_deleted = false; | ||||
} | } | ||||
rv = vm_map_insert(map, NULL, 0, grow_start, | rv = vm_map_insert(map, NULL, 0, grow_start, | ||||
grow_start + grow_amount, | grow_start + grow_amount, | ||||
stack_entry->protection, stack_entry->max_protection, | stack_entry->protection, stack_entry->max_protection, | ||||
MAP_STACK_GROWS_DOWN); | MAP_STACK_GROWS_DOWN); | ||||
if (rv != KERN_SUCCESS) { | if (rv != KERN_SUCCESS && gap_deleted) { | ||||
if (gap_deleted) { | rv1 = vm_map_insert(map, NULL, 0, gap_start, | ||||
rv1 = vm_map_insert(map, NULL, 0, gap_start, | gap_end, VM_PROT_NONE, VM_PROT_NONE, | ||||
gap_end, VM_PROT_NONE, VM_PROT_NONE, | MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN); | ||||
MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN); | MPASS(rv1 == KERN_SUCCESS); | ||||
MPASS(rv1 == KERN_SUCCESS); | } else if (rv != KERN_SUCCESS) | ||||
} else { | vm_map_entry_resize_free(map, gap_entry, | ||||
gap_entry->end += grow_amount; | gap_entry->start, gap_entry->end + grow_amount); | ||||
vm_map_entry_resize_free(map, gap_entry); | |||||
} | |||||
} | |||||
} else { | } else { | ||||
grow_start = stack_entry->end; | grow_start = stack_entry->end; | ||||
cred = stack_entry->cred; | cred = stack_entry->cred; | ||||
if (cred == NULL && stack_entry->object.vm_object != NULL) | if (cred == NULL && stack_entry->object.vm_object != NULL) | ||||
cred = stack_entry->object.vm_object->cred; | cred = stack_entry->object.vm_object->cred; | ||||
if (cred != NULL && !swap_reserve_by_cred(grow_amount, cred)) | if (cred != NULL && !swap_reserve_by_cred(grow_amount, cred)) | ||||
rv = KERN_NO_SPACE; | rv = KERN_NO_SPACE; | ||||
/* Grow the underlying object if applicable. */ | /* Grow the underlying object if applicable. */ | ||||
else if (stack_entry->object.vm_object == NULL || | else if (stack_entry->object.vm_object == NULL || | ||||
vm_object_coalesce(stack_entry->object.vm_object, | vm_object_coalesce(stack_entry->object.vm_object, | ||||
stack_entry->offset, | stack_entry->offset, | ||||
(vm_size_t)(stack_entry->end - stack_entry->start), | (vm_size_t)(stack_entry->end - stack_entry->start), | ||||
(vm_size_t)grow_amount, cred != NULL)) { | (vm_size_t)grow_amount, cred != NULL)) { | ||||
if (gap_entry->start + grow_amount == gap_entry->end) | if (gap_entry->start + grow_amount == gap_entry->end) { | ||||
vm_map_entry_delete(map, gap_entry); | vm_map_entry_delete(map, gap_entry); | ||||
else | vm_map_entry_resize_free(map, stack_entry, | ||||
stack_entry->start, | |||||
stack_entry->end + grow_amount); | |||||
} else { | |||||
gap_entry->start += grow_amount; | gap_entry->start += grow_amount; | ||||
stack_entry->end += grow_amount; | stack_entry->end += grow_amount; | ||||
} | |||||
map->size += grow_amount; | map->size += grow_amount; | ||||
vm_map_entry_resize_free(map, stack_entry); | |||||
rv = KERN_SUCCESS; | rv = KERN_SUCCESS; | ||||
} else | } else | ||||
rv = KERN_FAILURE; | rv = KERN_FAILURE; | ||||
} | } | ||||
if (rv == KERN_SUCCESS && is_procstack) | if (rv == KERN_SUCCESS && is_procstack) | ||||
vm->vm_ssize += btoc(grow_amount); | vm->vm_ssize += btoc(grow_amount); | ||||
/* | /* | ||||
* Heed the MAP_WIREFUTURE flag if it was set for this process. | * Heed the MAP_WIREFUTURE flag if it was set for this process. | ||||
*/ | */ | ||||
if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE) != 0) { | if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE) != 0) { | ||||
vm_map_unlock(map); | vm_map_unlock(map); | ||||
vm_map_wire(map, grow_start, grow_start + grow_amount, | vm_map_wire(map, grow_start, grow_start + grow_amount, | ||||
VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); | VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); | ||||
vm_map_lock_read(map); | vm_map_lock_read(map); | ||||
Context not available. |
vm_map_maxfree_left, please honor the symbols namespace.