- Update the vm_object locking in vm_map_insert().
This commit is contained in:
parent
b634e61b93
commit
fb6235893f
@ -811,17 +811,22 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
||||
if (cow & MAP_DISABLE_COREDUMP)
|
||||
protoeflags |= MAP_ENTRY_NOCOREDUMP;
|
||||
|
||||
if (object) {
|
||||
if (object != NULL) {
|
||||
/*
|
||||
* When object is non-NULL, it could be shared with another
|
||||
* process. We have to set or clear OBJ_ONEMAPPING
|
||||
* appropriately.
|
||||
* OBJ_ONEMAPPING must be cleared unless this mapping
|
||||
* is trivially proven to be the only mapping for any
|
||||
* of the object's pages. (Object granularity
|
||||
* reference counting is insufficient to recognize
|
||||
* aliases with precision.)
|
||||
*/
|
||||
vm_object_lock(object);
|
||||
if ((object->ref_count > 1) || (object->shadow_count != 0)) {
|
||||
if (object != kmem_object)
|
||||
mtx_lock(&Giant);
|
||||
VM_OBJECT_LOCK(object);
|
||||
if (object->ref_count > 1 || object->shadow_count != 0)
|
||||
vm_object_clear_flag(object, OBJ_ONEMAPPING);
|
||||
}
|
||||
vm_object_unlock(object);
|
||||
VM_OBJECT_UNLOCK(object);
|
||||
if (object != kmem_object)
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
else if ((prev_entry != &map->header) &&
|
||||
(prev_entry->eflags == protoeflags) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user