summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-11-06 05:33:02 +0000
committeralc <alc@FreeBSD.org>2004-11-06 05:33:02 +0000
commit4030274372d7f9f80cfaca348850163d9304a431 (patch)
treef75344d5038066255af0c0ea580ccb09e34bd84f /sys/vm
parent88e4a8c0bdafc82867314450455ec25c5ebd48db (diff)
downloadFreeBSD-src-4030274372d7f9f80cfaca348850163d9304a431.zip
FreeBSD-src-4030274372d7f9f80cfaca348850163d9304a431.tar.gz
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@
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_object.c2
-rw-r--r--sys/vm/vm_object.h1
-rw-r--r--sys/vm/vnode_pager.c5
3 files changed, 6 insertions, 2 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 3a28325..4df862b 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -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.
*/
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index 64e4d76..1f1acb6 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -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))
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index b09559b..c9634e0 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -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);
OpenPOWER on IntegriCloud