Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2016-12-30 13:04:43 +00:00
parent 99e3d68596
commit 9a4ee196dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310821

View File

@ -2927,8 +2927,8 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry)
offidxstart = OFF_TO_IDX(entry->offset);
offidxend = offidxstart + count;
VM_OBJECT_WLOCK(object);
if (object->ref_count != 1 &&
((object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING ||
if (object->ref_count != 1 && ((object->flags & (OBJ_NOSPLIT |
OBJ_ONEMAPPING)) == OBJ_ONEMAPPING ||
object == kernel_object || object == kmem_object)) {
vm_object_collapse(object);
@ -2941,7 +2941,8 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry)
vm_object_page_remove(object, offidxstart, offidxend,
OBJPR_NOTMAPPED);
if (object->type == OBJT_SWAP)
swap_pager_freespace(object, offidxstart, count);
swap_pager_freespace(object, offidxstart,
count);
if (offidxend >= object->size &&
offidxstart < object->size) {
size1 = object->size;
@ -2949,8 +2950,9 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry)
if (object->cred != NULL) {
size1 -= object->size;
KASSERT(object->charge >= ptoa(size1),
("vm_map_entry_delete: object->charge < 0"));
swap_release_by_cred(ptoa(size1), object->cred);
("object %p charge < 0", object));
swap_release_by_cred(ptoa(size1),
object->cred);
object->charge -= ptoa(size1);
}
}
@ -3168,13 +3170,15 @@ vm_map_copy_entry(
if ((src_object = src_entry->object.vm_object) != NULL) {
VM_OBJECT_WLOCK(src_object);
charged = ENTRY_CHARGED(src_entry);
if ((src_object->handle == NULL) &&
(src_object->type == OBJT_DEFAULT ||
src_object->type == OBJT_SWAP)) {
if (src_object->handle == NULL &&
(src_object->type == OBJT_DEFAULT ||
src_object->type == OBJT_SWAP)) {
vm_object_collapse(src_object);
if ((src_object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) {
if ((src_object->flags & (OBJ_NOSPLIT |
OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) {
vm_object_split(src_entry);
src_object = src_entry->object.vm_object;
src_object =
src_entry->object.vm_object;
}
}
vm_object_reference_locked(src_object);
@ -3201,8 +3205,10 @@ vm_map_copy_entry(
*fork_charge += size;
}
}
src_entry->eflags |= (MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY);
dst_entry->eflags |= (MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY);
src_entry->eflags |= MAP_ENTRY_COW |
MAP_ENTRY_NEEDS_COPY;
dst_entry->eflags |= MAP_ENTRY_COW |
MAP_ENTRY_NEEDS_COPY;
dst_entry->offset = src_entry->offset;
if (src_entry->eflags & MAP_ENTRY_VN_WRITECNT) {
/*
@ -3825,10 +3831,10 @@ vm_map_growstack(struct proc *p, vm_offset_t addr)
rv = KERN_NO_SPACE;
/* Grow the underlying object if applicable. */
else if (stack_entry->object.vm_object == NULL ||
vm_object_coalesce(stack_entry->object.vm_object,
stack_entry->offset,
(vm_size_t)(stack_entry->end - stack_entry->start),
(vm_size_t)grow_amount, cred != NULL)) {
vm_object_coalesce(stack_entry->object.vm_object,
stack_entry->offset,
(vm_size_t)(stack_entry->end - stack_entry->start),
(vm_size_t)grow_amount, cred != NULL)) {
map->size += (addr - stack_entry->end);
/* Update the current entry. */
stack_entry->end = addr;