summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-05-01 03:29:20 +0000
committeralc <alc@FreeBSD.org>2003-05-01 03:29:20 +0000
commitc2343f725ba4bf59ee03f1d8475c57c5c693d0da (patch)
tree7ee4d641aeefe2d5a3b6b9662eec26478c27926d /sys/vm
parente9c4374a870ff015fdecd6820a2b46caaa97bb4f (diff)
downloadFreeBSD-src-c2343f725ba4bf59ee03f1d8475c57c5c693d0da.zip
FreeBSD-src-c2343f725ba4bf59ee03f1d8475c57c5c693d0da.tar.gz
- Update the vm_object locking in vm_object_reference().
- Convert some dead code in vm_object_reference() into a comment.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_object.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 8756c8e..822c8cf 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -369,28 +369,26 @@ vm_object_allocate(objtype_t type, vm_pindex_t size)
/*
* vm_object_reference:
*
- * Gets another reference to the given object.
+ * Gets another reference to the given object. Note: OBJ_DEAD
+ * objects can be referenced during final cleaning.
*/
void
vm_object_reference(vm_object_t object)
{
if (object == NULL)
return;
-
- vm_object_lock(object);
-#if 0
- /* object can be re-referenced during final cleaning */
- KASSERT(!(object->flags & OBJ_DEAD),
- ("vm_object_reference: attempting to reference dead obj"));
-#endif
-
+ if (object != kmem_object)
+ mtx_lock(&Giant);
+ VM_OBJECT_LOCK(object);
object->ref_count++;
+ VM_OBJECT_UNLOCK(object);
if (object->type == OBJT_VNODE) {
while (vget((struct vnode *) object->handle, LK_RETRY, curthread)) {
printf("vm_object_reference: delay in getting object\n");
}
}
- vm_object_unlock(object);
+ if (object != kmem_object)
+ mtx_unlock(&Giant);
}
/*
OpenPOWER on IntegriCloud