Complete the page queues locking needed for the page-based copy-

on-write (COW) mechanism.  (This mechanism is used by the zero-copy
TCP/IP implementation.)
 - Extend the scope of the page queues lock in vm_fault()
   to cover vm_page_cowfault().
 - Modify vm_page_cowfault() to release the page queues lock
   if it sleeps.
This commit is contained in:
alc 2002-10-19 18:34:39 +00:00
parent 7fb24b2896
commit 55d840ce51
2 changed files with 9 additions and 3 deletions

View File

@ -319,12 +319,13 @@ RetryFault:;
/*
* check for page-based copy on write
*/
vm_page_lock_queues();
if ((fs.m->cow) &&
(fault_type & VM_PROT_WRITE)) {
s = splvm();
vm_page_cowfault(fs.m);
splx(s);
vm_page_unlock_queues();
unlock_things(&fs);
goto RetryFault;
}
@ -345,7 +346,6 @@ RetryFault:;
* around with a vm_page_t->busy page except, perhaps,
* to pmap it.
*/
vm_page_lock_queues();
if ((fs.m->flags & PG_BUSY) || fs.m->busy) {
vm_page_unlock_queues();
unlock_things(&fs);

View File

@ -1815,10 +1815,16 @@ vm_page_cowfault(vm_page_t m)
retry_alloc:
vm_page_remove(m);
mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
/*
* An interrupt allocation is requested because the page
* queues lock is held.
*/
mnew = vm_page_alloc(object, pindex, VM_ALLOC_INTERRUPT);
if (mnew == NULL) {
vm_page_insert(m, object, pindex);
vm_page_unlock_queues();
VM_WAIT;
vm_page_lock_queues();
goto retry_alloc;
}