summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-06-04 06:00:55 +0000
committeralc <alc@FreeBSD.org>2003-06-04 06:00:55 +0000
commit1c0932407b0f45ce360569f80d08c31857bfca85 (patch)
tree4b7bb674a116c9fd51cbc1ae8deae642cd51ea2a /sys/vm
parent1646a714c55c06d685c29c59ad5614f793789e79 (diff)
downloadFreeBSD-src-1c0932407b0f45ce360569f80d08c31857bfca85.zip
FreeBSD-src-1c0932407b0f45ce360569f80d08c31857bfca85.tar.gz
- Add vm object locking to vm_object_deallocate(). (Still more
changes are required.) - Remove special-case macros for kmem object locking. They are no longer used.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_object.c27
-rw-r--r--sys/vm/vm_object.h5
2 files changed, 15 insertions, 17 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 18db925..8b098ba 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -440,14 +440,13 @@ vm_object_deallocate(vm_object_t object)
{
vm_object_t temp;
- vm_object_lock(object);
+ if (object != kmem_object)
+ mtx_lock(&Giant);
while (object != NULL) {
-
+ VM_OBJECT_LOCK(object);
if (object->type == OBJT_VNODE) {
- VM_OBJECT_LOCK(object);
vm_object_vndeallocate(object);
- mtx_unlock(&Giant);
- return;
+ goto done;
}
KASSERT(object->ref_count != 0,
@@ -461,8 +460,8 @@ vm_object_deallocate(vm_object_t object)
*/
object->ref_count--;
if (object->ref_count > 1) {
- vm_object_unlock(object);
- return;
+ VM_OBJECT_UNLOCK(object);
+ goto done;
} else if (object->ref_count == 1) {
if (object->shadow_count == 0) {
vm_object_set_flag(object, OBJ_ONEMAPPING);
@@ -487,11 +486,14 @@ vm_object_deallocate(vm_object_t object)
robject->paging_in_progress ||
object->paging_in_progress
) {
+ /* XXX */ VM_OBJECT_UNLOCK(object);
vm_object_pip_sleep(robject, "objde1");
vm_object_pip_sleep(object, "objde2");
+ /* XXX */ VM_OBJECT_LOCK(object);
}
-
+ VM_OBJECT_UNLOCK(object);
if (robject->ref_count == 1) {
+ /* XXX */ VM_OBJECT_LOCK(robject);
robject->ref_count--;
object = robject;
goto doterm;
@@ -502,11 +504,10 @@ vm_object_deallocate(vm_object_t object)
continue;
}
}
- vm_object_unlock(object);
- return;
+ VM_OBJECT_UNLOCK(object);
+ goto done;
}
doterm:
- VM_OBJECT_LOCK(object);
temp = object->backing_object;
if (temp != NULL) {
VM_OBJECT_LOCK(temp);
@@ -527,7 +528,9 @@ doterm:
VM_OBJECT_UNLOCK(object);
object = temp;
}
- vm_object_unlock(object);
+done:
+ if (object != kmem_object)
+ mtx_unlock(&Giant);
}
/*
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index c3bfe09..73d5d65 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -182,11 +182,6 @@ extern struct vm_object kmem_object_store;
#define VM_OBJECT_MTX(object) (&(object)->mtx)
#define VM_OBJECT_UNLOCK(object) mtx_unlock(&(object)->mtx)
-#define vm_object_lock(object) \
- mtx_lock((object) == kmem_object ? &kmem_object->mtx : &Giant)
-#define vm_object_unlock(object) \
- mtx_unlock((object) == kmem_object ? &kmem_object->mtx : &Giant)
-
void vm_object_set_flag(vm_object_t object, u_short bits);
void vm_object_clear_flag(vm_object_t object, u_short bits);
void vm_object_pip_add(vm_object_t object, short i);
OpenPOWER on IntegriCloud