summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-04-25 02:59:06 +0000
committeralc <alc@FreeBSD.org>2009-04-25 02:59:06 +0000
commit4ffa3051a8799989b43481594165c440e60f74a6 (patch)
treecf00ac93642d2f7642ccb68c6e09fb04570befba /sys/vm
parent9d58d4a32eab116074bceb34bf6df459bd1e9b5b (diff)
downloadFreeBSD-src-4ffa3051a8799989b43481594165c440e60f74a6.zip
FreeBSD-src-4ffa3051a8799989b43481594165c440e60f74a6.tar.gz
Eliminate unnecessary calls to pmap_clear_modify(). Specifically, calling
pmap_clear_modify() on a page is pointless if that page is not mapped or it is only mapped for read access. Instead, assert that the page is not mapped or not mapped for write access as appropriate. Eliminate unnecessary clearing of a page's dirty mask. Instead, assert that the page's dirty mask is clear.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/swap_pager.c16
-rw-r--r--sys/vm/vnode_pager.c8
2 files changed, 14 insertions, 10 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index d1a1afc..39d00dd 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1407,10 +1407,6 @@ swp_pager_async_iodone(struct buf *bp)
}
} else if (bp->b_iocmd == BIO_READ) {
/*
- * For read success, clear dirty bits. Nobody should
- * have this page mapped but don't take any chances,
- * make sure the pmap modify bits are also cleared.
- *
* NOTE: for reads, m->dirty will probably be
* overridden by the original caller of getpages so
* we cannot set them in order to free the underlying
@@ -1427,9 +1423,11 @@ swp_pager_async_iodone(struct buf *bp)
* vm_page_wakeup(). We do not set reqpage's
* valid bits here, it is up to the caller.
*/
- pmap_clear_modify(m);
+ KASSERT(!pmap_page_is_mapped(m),
+ ("swp_pager_async_iodone: page %p is mapped", m));
m->valid = VM_PAGE_BITS_ALL;
- vm_page_undirty(m);
+ KASSERT(m->dirty == 0,
+ ("swp_pager_async_iodone: page %p is dirty", m));
/*
* We have to wake specifically requested pages
@@ -1447,11 +1445,13 @@ swp_pager_async_iodone(struct buf *bp)
}
} else {
/*
- * For write success, clear the modify and dirty
+ * For write success, clear the dirty
* status, then finish the I/O ( which decrements the
* busy count and possibly wakes waiter's up ).
*/
- pmap_clear_modify(m);
+ KASSERT((m->flags & PG_WRITEABLE) == 0,
+ ("swp_pager_async_iodone: page %p is not write"
+ " protected", m));
vm_page_undirty(m);
vm_page_io_finish(m);
if (vm_page_count_severe())
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index e8c7958..63dc148 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -944,8 +944,12 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
* Read filled up entire page.
*/
mt->valid = VM_PAGE_BITS_ALL;
- vm_page_undirty(mt); /* should be an assert? XXX */
- pmap_clear_modify(mt);
+ KASSERT(mt->dirty == 0,
+ ("vnode_pager_generic_getpages: page %p is dirty",
+ mt));
+ KASSERT(!pmap_page_is_mapped(mt),
+ ("vnode_pager_generic_getpages: page %p is mapped",
+ mt));
} else {
/*
* Read did not fill up entire page. Since this
OpenPOWER on IntegriCloud