diff options
author | jhb <jhb@FreeBSD.org> | 2003-05-01 21:16:38 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-05-01 21:16:38 +0000 |
commit | 9e17fca4258b0a8f169ab5253e584a3c6d1d4b55 (patch) | |
tree | c08a5c3341f9680721f7ab6d61465d3cd7e78163 /sys/kern/kern_fork.c | |
parent | 8716bb50e311ba9636291e5d83d84d05f13fd13b (diff) | |
download | FreeBSD-src-9e17fca4258b0a8f169ab5253e584a3c6d1d4b55.zip FreeBSD-src-9e17fca4258b0a8f169ab5253e584a3c6d1d4b55.tar.gz |
Initialize and destroy the struct proc mutex in the proc zone's init and
fini routines instead of in fork() and wait(). This has the nice side
benefit that the proc lock of any process on the allproc list is always
valid and sched_lock doesn't have to be used to test against PRS_NEW
anymore.
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 7d2c65c..17387f8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -447,6 +447,9 @@ again: if (pages != 0) pmap_new_altkstack(td2, pages); + PROC_LOCK(p2); + PROC_LOCK(p1); + #define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start)) bzero(&p2->p_startzero, @@ -458,10 +461,6 @@ again: bzero(&kg2->kg_startzero, (unsigned) RANGEOF(struct ksegrp, kg_startzero, kg_endzero)); - mtx_init(&p2->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); - PROC_LOCK(p2); - PROC_LOCK(p1); - bcopy(&p1->p_startcopy, &p2->p_startcopy, (unsigned) RANGEOF(struct proc, p_startcopy, p_endcopy)); bcopy(&td->td_startcopy, &td2->td_startcopy, |