PERFORCE change 90998 for review
John Baldwin
jhb at FreeBSD.org
Fri Feb 3 13:35:17 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=90998
Change 90998 by jhb at jhb_slimer on 2006/02/03 21:34:55
Block in exit1() until all holds on a process are released.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_exit.c#109 edit
.. //depot/projects/smpng/sys/sys/proc.h#161 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_exit.c#109 (text+ko) ====
@@ -175,6 +175,13 @@
p->p_flag |= P_WEXIT;
+ /*
+ * Wait for any processes that have a hold on our vmspace to
+ * release their reference.
+ */
+ while (p->p_lock > 0)
+ msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0);
+
PROC_LOCK(p->p_pptr);
sigqueue_take(p->p_ksi);
PROC_UNLOCK(p->p_pptr);
==== //depot/projects/smpng/sys/sys/proc.h#161 (text+ko) ====
@@ -785,6 +785,7 @@
} while (0)
#define _PHOLD(p) do { \
PROC_LOCK_ASSERT((p), MA_OWNED); \
+ KASSERT(!((p)->p_flag & P_WEXIT), ("PHOLD of exiting process"));\
(p)->p_lock++; \
if (((p)->p_sflag & PS_INMEM) == 0) \
faultin((p)); \
@@ -798,6 +799,8 @@
#define _PRELE(p) do { \
PROC_LOCK_ASSERT((p), MA_OWNED); \
(--(p)->p_lock); \
+ if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0) \
+ wakeup(&(p)->p_lock); \
} while (0)
/* Check whether a thread is safe to be swapped out. */
More information about the p4-projects
mailing list