summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-12-05 20:50:24 +0000
committerkib <kib@FreeBSD.org>2008-12-05 20:50:24 +0000
commitccad2ebfb201232304a87b7e7df40462dbede7b5 (patch)
treee6cf97b3b6771409805827fd23c9d98d223476d3 /sys/kern/kern_proc.c
parentca85df46cbe8e0ca1a618e41a0fb6ef93b7b940e (diff)
downloadFreeBSD-src-ccad2ebfb201232304a87b7e7df40462dbede7b5.zip
FreeBSD-src-ccad2ebfb201232304a87b7e7df40462dbede7b5.tar.gz
Several threads in a process may do vfork() simultaneously. Then, all
parent threads sleep on the parent' struct proc until corresponding child releases the vmspace. Each sleep is interlocked with proc mutex of the child, that triggers assertion in the sleepq_add(). The assertion requires that at any time, all simultaneous sleepers for the channel use the same interlock. Silent the assertion by using conditional variable allocated in the child. Broadcast the variable event on exec() and exit(). Since struct proc * sleep wait channel is overloaded for several unrelated events, I was unable to remove wakeups from the places where cv_broadcast() is added, except exec(). Reported and tested by: ganbold Suggested and reviewed by: jhb MFC after: 2 week
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 4e5ceea..0b6b6d5 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -231,6 +231,7 @@ proc_init(void *mem, int size, int flags)
bzero(&p->p_mtx, sizeof(struct mtx));
mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE);
+ cv_init(&p->p_pwait, "ppwait");
TAILQ_INIT(&p->p_threads); /* all threads in proc */
EVENTHANDLER_INVOKE(process_init, p);
p->p_stats = pstats_alloc();
OpenPOWER on IntegriCloud