Changed a thread_sleep into an spl protected tsleep. A deadlock can occur

otherwise. Minor efficiency improvement in vm_page_free().

Submitted by:	John Dyson
This commit is contained in:
David Greenman 1994-10-23 06:15:04 +00:00
parent f58a49599d
commit 47c9acfdeb
2 changed files with 12 additions and 9 deletions

View File

@ -66,7 +66,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_fault.c,v 1.9 1994/10/15 13:33:07 davidg Exp $
* $Id: vm_fault.c,v 1.10 1994/10/22 02:18:01 davidg Exp $
*/
/*
@ -325,12 +325,10 @@ vm_fault(map, vaddr, fault_type, change_wiring)
}
#endif
if ((cnt.v_free_count < cnt.v_free_min) &&
swap_pager_full && !object->shadow && (!object->pager ||
if (swap_pager_full && !object->shadow && (!object->pager ||
(object->pager && object->pager->pg_type == PG_SWAP &&
!vm_pager_has_page(object->pager, offset+object->paging_offset)))) {
if (vaddr < VM_MAXUSER_ADDRESS &&
curproc && curproc->p_pid >= 48) /* XXX */ {
if (vaddr < VM_MAXUSER_ADDRESS && curproc && curproc->p_pid >= 48) /* XXX */ {
printf("Process %lu killed by vm_fault -- out of swap\n", (u_long)curproc->p_pid);
psignal(curproc, SIGKILL);
curproc->p_estcpu = 0;
@ -654,12 +652,16 @@ vm_fault(map, vaddr, fault_type, change_wiring)
* If the page is being brought
* in, wait for it and then retry.
*/
PAGE_ASSERT_WAIT(copy_m, !change_wiring);
RELEASE_PAGE(m);
copy_object->ref_count--;
vm_object_unlock(copy_object);
UNLOCK_THINGS;
thread_block("fltcpy");
spl = splhigh();
if( copy_m->flags & (PG_BUSY|PG_VMIO)) {
copy_m->flags |= PG_WANTED;
tsleep((caddr_t)copy_m,PSWP,"vmpfwc",0);
}
splx(spl);
vm_object_deallocate(first_object);
goto RetryFault;
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91
* $Id: vm_page.c,v 1.10 1994/10/09 01:52:13 phk Exp $
* $Id: vm_page.c,v 1.11 1994/10/18 14:59:19 davidg Exp $
*/
/*
@ -725,7 +725,8 @@ void vm_page_free(mem)
} else {
splx(s);
}
wakeup((caddr_t) mem);
if( mem->flags & PG_WANTED)
wakeup((caddr_t) mem);
cnt.v_tfree++;
}