diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-06 12:43:21 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-12-06 12:43:21 +0000 |
commit | eebe1c8766771b51396f0c4de8f48b058653d374 (patch) | |
tree | 995507ce72473653abb79d66933ee5de9bac7446 /sys | |
parent | bc76544e734973512f81c56a6cc5c67700a21552 (diff) |
Keep track of how many pages a vnode hold with vhold and vholdrele
so that we can get back the old behavior where a vnode with cached data
is less likely to be recycled than a vnode without cached data.
XXX - This is a brute-force solution - we do it where uvmexp.vnodepages
are changed, I am not really sure it is correct but people have been
very happy with the diff so far and want this in the tree.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_page.c | 14 | ||||
-rw-r--r-- | sys/uvm/uvm_vnode.c | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 0da38fc51ed..ed2a8c6f601 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.37 2001/12/04 23:22:42 art Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.38 2001/12/06 12:43:20 art Exp $ */ /* $NetBSD: uvm_page.c,v 1.66 2001/09/10 21:19:43 chris Exp $ */ /* @@ -197,10 +197,14 @@ uvm_pageremove(pg) simple_unlock(&uvm.hashlock); splx(s); - if (UVM_OBJ_IS_VTEXT(pg->uobject)) { - uvmexp.vtextpages--; - } else if (UVM_OBJ_IS_VNODE(pg->uobject)) { - uvmexp.vnodepages--; + if (UVM_OBJ_IS_VTEXT(pg->uobject) || UVM_OBJ_IS_VNODE(pg->uobject)) { + if (UVM_OBJ_IS_VNODE(pg->uobject)) + uvmexp.vnodepages--; + else + uvmexp.vtextpages--; + s = splbio(); + vholdrele((struct vnode *)pg->uobject); + splx(s); } /* object should be locked */ diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c index 180acc16e66..67ccf7d605c 100644 --- a/sys/uvm/uvm_vnode.c +++ b/sys/uvm/uvm_vnode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_vnode.c,v 1.29 2001/12/04 23:22:42 art Exp $ */ +/* $OpenBSD: uvm_vnode.c,v 1.30 2001/12/06 12:43:20 art Exp $ */ /* $NetBSD: uvm_vnode.c,v 1.51 2001/08/17 05:53:02 chs Exp $ */ /* @@ -899,6 +899,7 @@ uvn_findpage(uobj, offset, pgp, flags) int flags; { struct vm_page *pg; + int s; UVMHIST_FUNC("uvn_findpage"); UVMHIST_CALLED(ubchist); UVMHIST_LOG(ubchist, "vp %p off 0x%lx", uobj, offset,0,0); @@ -932,6 +933,9 @@ uvn_findpage(uobj, offset, pgp, flags) } else { uvmexp.vnodepages++; } + s = splbio(); + vhold((struct vnode *)uobj); + splx(s); UVMHIST_LOG(ubchist, "alloced",0,0,0,0); break; } else if (flags & UFP_NOCACHE) { |