Module Name: src Committed By: yamt Date: Fri Nov 2 08:26:33 UTC 2012
Modified Files: src/sys/uvm [yamt-pagecache]: uvm_vnode.c Log Message: uvn_findpage: fix dense case. add comments. To generate a diff of this commit: cvs rdiff -u -r1.97.2.8 -r1.97.2.9 src/sys/uvm/uvm_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_vnode.c diff -u src/sys/uvm/uvm_vnode.c:1.97.2.8 src/sys/uvm/uvm_vnode.c:1.97.2.9 --- src/sys/uvm/uvm_vnode.c:1.97.2.8 Tue Oct 30 17:23:03 2012 +++ src/sys/uvm/uvm_vnode.c Fri Nov 2 08:26:33 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_vnode.c,v 1.97.2.8 2012/10/30 17:23:03 yamt Exp $ */ +/* $NetBSD: uvm_vnode.c,v 1.97.2.9 2012/11/02 08:26:33 yamt Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.97.2.8 2012/10/30 17:23:03 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.97.2.9 2012/11/02 08:26:33 yamt Exp $"); #include "opt_uvmhist.h" @@ -242,6 +242,13 @@ uvn_findpages(struct uvm_object *uobj, v return (found); } +/* + * uvn_findpage: find a single page + * + * if a suitable page was found, put it in *pgp and return 1. + * otherwise return 0. + */ + static int uvn_findpage(struct uvm_object *uobj, voff_t offset, struct vm_page **pgp, unsigned int flags, struct uvm_page_array *a, unsigned int nleft) @@ -269,7 +276,7 @@ uvn_findpage(struct uvm_object *uobj, vo * uvn_findpages. in that case, fillflags used by the caller * might not match strictly with ours. * in particular, the caller might have filled the array - * without DIRTYONLY or DENSE but passed us UFP_DIRTYONLY. + * without DENSE but passed us UFP_DIRTYONLY (thus DENSE). */ pg = uvm_page_array_fill_and_peek(a, uobj, offset, nleft, fillflags); @@ -277,7 +284,15 @@ uvn_findpage(struct uvm_object *uobj, vo KASSERT( ((fillflags & UVM_PAGE_ARRAY_FILL_BACKWARD) != 0) == (pg->offset < offset)); + KASSERT(uvm_pagelookup(uobj, offset) == NULL + || ((fillflags & UVM_PAGE_ARRAY_FILL_DIRTY) != 0 && + radix_tree_get_tag(&uobj->uo_pages, + offset >> PAGE_SHIFT, UVM_PAGE_DIRTY_TAG) == 0)); pg = NULL; + if ((fillflags & UVM_PAGE_ARRAY_FILL_DENSE) != 0) { + UVMHIST_LOG(ubchist, "dense", 0,0,0,0); + return 0; + } } /* nope? allocate one now */