mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-07 13:14:51 +00:00
Passing a parameter to vm_map_entry_resize_free that describes the
amount of resizing reduces the number of functions changing the vm_map invariants regarding the max_free field of map entries. Reviewed by: markj (mentor) Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D20356
This commit is contained in:
parent
f9039ad43e
commit
1895f5202a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348115
@ -1251,7 +1251,7 @@ vm_map_entry_unlink(vm_map_t map,
|
||||
* The map must be locked, and leaves it so.
|
||||
*/
|
||||
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, size_t grow_amount)
|
||||
{
|
||||
vm_map_entry_t llist, rlist, root;
|
||||
|
||||
@ -1262,11 +1262,12 @@ vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t entry)
|
||||
("vm_map_entry_resize_free: resize_free object not mapped"));
|
||||
vm_map_splay_findnext(root, &rlist);
|
||||
root->right = NULL;
|
||||
entry->end += grow_amount;
|
||||
map->root = vm_map_splay_merge(root, llist, rlist,
|
||||
root->left, root->right);
|
||||
VM_MAP_ASSERT_CONSISTENT(map);
|
||||
CTR3(KTR_VM, "vm_map_entry_resize_free: map %p, nentries %d, entry %p", map,
|
||||
map->nentries, entry);
|
||||
CTR3(KTR_VM, "vm_map_entry_resize_free: map %p, nentries %d, entry %p",
|
||||
map, map->nentries, entry);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1486,8 +1487,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
||||
prev_entry));
|
||||
if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0)
|
||||
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,
|
||||
end - prev_entry->end);
|
||||
vm_map_simplify_entry(map, prev_entry);
|
||||
return (KERN_SUCCESS);
|
||||
}
|
||||
@ -4314,7 +4315,7 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry)
|
||||
} else {
|
||||
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, -grow_amount);
|
||||
gap_deleted = false;
|
||||
}
|
||||
rv = vm_map_insert(map, NULL, 0, grow_start,
|
||||
@ -4327,10 +4328,9 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry)
|
||||
gap_end, VM_PROT_NONE, VM_PROT_NONE,
|
||||
MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN);
|
||||
MPASS(rv1 == KERN_SUCCESS);
|
||||
} else {
|
||||
gap_entry->end += grow_amount;
|
||||
vm_map_entry_resize_free(map, gap_entry);
|
||||
}
|
||||
} else
|
||||
vm_map_entry_resize_free(map, gap_entry,
|
||||
grow_amount);
|
||||
}
|
||||
} else {
|
||||
grow_start = stack_entry->end;
|
||||
@ -4349,9 +4349,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry)
|
||||
vm_map_entry_delete(map, gap_entry);
|
||||
else
|
||||
gap_entry->start += grow_amount;
|
||||
stack_entry->end += grow_amount;
|
||||
map->size += grow_amount;
|
||||
vm_map_entry_resize_free(map, stack_entry);
|
||||
vm_map_entry_resize_free(map, stack_entry, grow_amount);
|
||||
rv = KERN_SUCCESS;
|
||||
} else
|
||||
rv = KERN_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user