summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_vnode.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2009-06-02 23:00:18 +0000
committeroga <oga@openbsd.org>2009-06-02 23:00:18 +0000
commit7937722e7578dca6d249d954d546a75a86649dca (patch)
tree7f1360fd22002b2beafe1bd8dc221f2a8d9faf56 /sys/uvm/uvm_vnode.c
parentBring interface list handling up to disk and cd behaviour of being (diff)
downloadwireguard-openbsd-7937722e7578dca6d249d954d546a75a86649dca.tar.xz
wireguard-openbsd-7937722e7578dca6d249d954d546a75a86649dca.zip
Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object RB_TREE. Right now this is approximately the same speed, but cleaner. When biglock usage is reduced this will improve concurrency due to lock contention.. ok beck@ art@. Thanks to jasper for the speed testing.
Diffstat (limited to 'sys/uvm/uvm_vnode.c')
-rw-r--r--sys/uvm/uvm_vnode.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index f52f6921336..6ea52aed027 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_vnode.c,v 1.60 2009/06/01 19:54:02 oga Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.61 2009/06/02 23:00:19 oga Exp $ */
/* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */
/*
@@ -271,7 +271,7 @@ uvn_attach(void *arg, vm_prot_t accessprot)
* now set up the uvn.
*/
uvn->u_obj.pgops = &uvm_vnodeops;
- TAILQ_INIT(&uvn->u_obj.memq);
+ RB_INIT(&uvn->u_obj.memt);
uvn->u_obj.uo_npages = 0;
uvn->u_obj.uo_refs = 1; /* just us... */
oldflags = uvn->u_flags;
@@ -438,11 +438,7 @@ uvn_detach(struct uvm_object *uobj)
if (uvn->u_flags & UVM_VNODE_WRITEABLE) {
LIST_REMOVE(uvn, u_wlist);
}
-#ifdef DIAGNOSTIC
- if (!TAILQ_EMPTY(&uobj->memq))
- panic("uvn_deref: vnode VM object still has pages afer "
- "syncio/free flush");
-#endif
+ KASSERT(RB_EMPTY(&uobj->memt));
oldflags = uvn->u_flags;
uvn->u_flags = 0;
simple_unlock(&uobj->vmobjlock);
@@ -559,7 +555,7 @@ uvm_vnp_terminate(struct vnode *vp)
while (uvn->u_obj.uo_npages) {
#ifdef DEBUG
struct vm_page *pp;
- TAILQ_FOREACH(pp, &uvn->u_obj.memq, fq.queues.listq) {
+ RB_FOREACH(pp, uobj_pgs, &uvn->u_obj.memt) {
if ((pp->pg_flags & PG_BUSY) == 0)
panic("uvm_vnp_terminate: detected unbusy pg");
}