From aeada54307a219aea2178377fc520f66154d8cba Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 13 Oct 2010 11:01:04 +0000 Subject: [PATCH] Don't reorder page on the age queue if the lookup is done by the pagedaemon. This mimics normal kernel behaviour where pmap_kentered mappings are not tracked for references. Without this change the vnode pager's clustering could cause one page to be released by the pagedaemon, and the rest of the pages in the pageout cluster made unlikely candidates to be released soon. --- sys/rump/librump/rumpkern/vm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/rump/librump/rumpkern/vm.c b/sys/rump/librump/rumpkern/vm.c index 4b11d8b07ce6..d2ca459afb36 100644 --- a/sys/rump/librump/rumpkern/vm.c +++ b/sys/rump/librump/rumpkern/vm.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm.c,v 1.96 2010/09/24 22:51:51 rmind Exp $ */ +/* $NetBSD: vm.c,v 1.97 2010/10/13 11:01:04 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.96 2010/09/24 22:51:51 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.97 2010/10/13 11:01:04 pooka Exp $"); #include #include @@ -464,14 +464,23 @@ uvm_pageratop(vaddr_t va) return pg; } -/* Called with the vm object locked */ +/* + * Called with the vm object locked. + * + * Put vnode object pages at the end of the access queue to indicate + * they have been recently accessed and should not be immediate + * candidates for pageout. Do not do this for lookups done by + * the pagedaemon to mimic pmap_kentered mappings which don't track + * access information. + */ struct vm_page * uvm_pagelookup(struct uvm_object *uobj, voff_t off) { struct vm_page *pg; + bool ispagedaemon = curlwp == uvm.pagedaemon_lwp; pg = rb_tree_find_node(&uobj->rb_tree, &off); - if (pg && !UVM_OBJ_IS_AOBJ(pg->uobject)) { + if (pg && !UVM_OBJ_IS_AOBJ(pg->uobject) && !ispagedaemon) { mutex_enter(&uvm_pageqlock); TAILQ_REMOVE(&vmpage_lruqueue, pg, pageq.queue); TAILQ_INSERT_TAIL(&vmpage_lruqueue, pg, pageq.queue);