o Synchronize updates to struct vm_page::cow with the page queues lock.

This commit is contained in:
alc 2002-09-02 04:04:12 +00:00
parent 6be4ef92c4
commit ee02e59c60
2 changed files with 8 additions and 7 deletions

View File

@ -96,7 +96,9 @@ socow_iodone(void *addr, void *args)
pp = PHYS_TO_VM_PAGE(paddr);
s = splvm();
/* remove COW mapping */
vm_page_lock_queues();
vm_page_cowclear(pp);
vm_page_unlock_queues();
vm_object_deallocate(pp->object);
splx(s);
/* note that sf_buf_free() unwires the page for us*/
@ -141,12 +143,12 @@ socow_setup(struct mbuf *m0, struct uio *uio)
/*
* set up COW
*/
vm_page_lock_queues();
vm_page_cowsetup(pp);
/*
* wire the page for I/O
*/
vm_page_lock_queues();
vm_page_wire(pp);
vm_page_unlock_queues();

View File

@ -1812,10 +1812,9 @@ void
vm_page_cowclear(vm_page_t m)
{
/* XXX KDM find out if giant is required here. */
GIANT_REQUIRED;
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
if (m->cow) {
atomic_subtract_int(&m->cow, 1);
m->cow--;
/*
* let vm_fault add back write permission lazily
*/
@ -1828,9 +1827,9 @@ vm_page_cowclear(vm_page_t m)
void
vm_page_cowsetup(vm_page_t m)
{
/* XXX KDM find out if giant is required here */
GIANT_REQUIRED;
atomic_add_int(&m->cow, 1);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
m->cow++;
vm_page_protect(m, VM_PROT_READ);
}