summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-04-25 07:58:59 +0000
committeralc <alc@FreeBSD.org>2004-04-25 07:58:59 +0000
commit44440f7818be724418be11978404a926ee853960 (patch)
treeb58b1a6c862ecd7e35323b6de574192dcb4dc1b9 /sys/vm
parent6001f5dc12c780c315e92fa26087ba79ea5a5ca8 (diff)
downloadFreeBSD-src-44440f7818be724418be11978404a926ee853960.zip
FreeBSD-src-44440f7818be724418be11978404a926ee853960.tar.gz
Zero the physical page only if it is invalid and not prezeroed.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/phys_pager.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c
index a5fe74c..cdeb614 100644
--- a/sys/vm/phys_pager.c
+++ b/sys/vm/phys_pager.c
@@ -142,17 +142,19 @@ phys_pager_getpages(vm_object_t object, vm_page_t *m, int count, int reqpage)
int i;
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
- vm_page_lock_queues();
for (i = 0; i < count; i++) {
- if ((m[i]->flags & PG_ZERO) == 0) {
- vm_page_unlock_queues();
- pmap_zero_page(m[i]);
- vm_page_lock_queues();
+ if (m[i]->valid == 0) {
+ if ((m[i]->flags & PG_ZERO) == 0)
+ pmap_zero_page(m[i]);
+ m[i]->valid = VM_PAGE_BITS_ALL;
}
- vm_page_flag_set(m[i], PG_ZERO);
+ KASSERT(m[i]->valid == VM_PAGE_BITS_ALL,
+ ("phys_pager_getpages: partially valid page %p", m[i]));
+ }
+ vm_page_lock_queues();
+ for (i = 0; i < count; i++) {
/* Switch off pv_entries */
vm_page_unmanage(m[i]);
- m[i]->valid = VM_PAGE_BITS_ALL;
m[i]->dirty = 0;
/* The requested page must remain busy, the others not. */
if (reqpage != i) {
OpenPOWER on IntegriCloud