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.
This commit is contained in:
parent
9d58d4a32e
commit
4ffa3051a8
@ -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())
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user