summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-04-09 04:36:58 +0000
committerdyson <dyson@FreeBSD.org>1996-04-09 04:36:58 +0000
commita3cc2115526720239bf249173d8cef81e6876367 (patch)
tree6592ba7212962d17e3eb14a4f985f8d8551b97f5 /sys/vm/vm_glue.c
parent69b0dd4b9f0062ebce7e638152d342d6a2c12864 (diff)
downloadFreeBSD-src-a3cc2115526720239bf249173d8cef81e6876367.zip
FreeBSD-src-a3cc2115526720239bf249173d8cef81e6876367.tar.gz
Reinstitute the map lock for processes being swapped out. This
is needed because of the vm_fault used to bring the page table page for the kernel stack (UPAGES) back in. The consequence of the previous incorrect change was a system hang.
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index f36101f..4bcb2cd 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -59,7 +59,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_glue.c,v 1.45 1996/04/07 17:39:23 bde Exp $
+ * $Id: vm_glue.c,v 1.46 1996/04/08 03:42:01 dyson Exp $
*/
#include "opt_ddb.h"
@@ -394,6 +394,9 @@ faultin(p)
int error;
++p->p_lock;
+#if defined(SWAP_DEBUG)
+ printf("swapping in %d\n", p->p_pid);
+#endif
ptaddr = trunc_page((u_int) vtopte(kstack));
(void) vm_fault(map, ptaddr, VM_PROT_READ|VM_PROT_WRITE, FALSE);
@@ -562,11 +565,22 @@ retry:
(p->p_slptime <= 4))
continue;
+ vm_map_reference(&p->p_vmspace->vm_map);
+ /*
+ * do not swapout a process that is waiting for VM
+ * datastructures there is a possible deadlock.
+ */
+ if (!lock_try_write(&p->p_vmspace->vm_map.lock)) {
+ vm_map_deallocate(&p->p_vmspace->vm_map);
+ continue;
+ }
+ vm_map_unlock(&p->p_vmspace->vm_map);
/*
* If the process has been asleep for awhile and had
* most of its pages taken away already, swap it out.
*/
swapout(p);
+ vm_map_deallocate(&p->p_vmspace->vm_map);
didswap++;
goto retry;
}
@@ -588,6 +602,9 @@ swapout(p)
vm_offset_t ptaddr;
int i;
+#if defined(SWAP_DEBUG)
+ printf("swapping out %d\n", p->p_pid);
+#endif
++p->p_stats->p_ru.ru_nswap;
/*
* remember the process resident count
OpenPOWER on IntegriCloud