Move a call to wakeup() from vm_object_terminate() to vnode_pager_dealloc()

because this call is only needed to wake threads that slept when they
discovered a dead object connected to a vnode.  To eliminate unnecessary
calls to wakeup() by vnode_pager_dealloc(), introduce a new flag,
OBJ_DISCONNECTWNT.

Reviewed by: tegge@
This commit is contained in:
alc 2004-11-06 05:33:02 +00:00
parent 88e4a8c0bd
commit 4030274372
4 changed files with 7 additions and 2 deletions

View File

@ -424,6 +424,7 @@ vop_stdcreatevobject(ap)
VM_OBJECT_LOCK(object);
if (object->flags & OBJ_DEAD) {
VOP_UNLOCK(vp, 0, td);
vm_object_set_flag(object, OBJ_DISCONNECTWNT);
msleep(object, VM_OBJECT_MTX(object), PDROP | PVM,
"vodead", 0);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);

View File

@ -642,8 +642,6 @@ vm_object_terminate(vm_object_t object)
TAILQ_REMOVE(&vm_object_list, object, object_list);
mtx_unlock(&vm_object_list_mtx);
wakeup(object);
/*
* Free the space for the object.
*/

View File

@ -148,6 +148,7 @@ struct vm_object {
#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */
#define OBJ_CLEANING 0x0200
#define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */
#define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */
#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)
#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT))

View File

@ -143,6 +143,7 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
VM_OBJECT_LOCK(object);
if ((object->flags & OBJ_DEAD) == 0)
break;
vm_object_set_flag(object, OBJ_DISCONNECTWNT);
msleep(object, VM_OBJECT_MTX(object), PDROP | PVM, "vadead", 0);
}
@ -191,6 +192,10 @@ vnode_pager_dealloc(object)
object->handle = NULL;
object->type = OBJT_DEAD;
if (object->flags & OBJ_DISCONNECTWNT) {
vm_object_clear_flag(object, OBJ_DISCONNECTWNT);
wakeup(object);
}
ASSERT_VOP_LOCKED(vp, "vnode_pager_dealloc");
vp->v_object = NULL;
vp->v_vflag &= ~(VV_TEXT | VV_OBJBUF);