Date: Thu, 10 May 2007 15:28:23 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 119631 for review Message-ID: <200705101528.l4AFSM8A016562@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119631 Change 119631 by jhb@jhb_mutex on 2007/05/10 15:28:19 Move cpu_exit() sooner. There's no need to make this happen this late (most of them are nops, the others all deal with stuff that only affects userland). Moving it allows us to avoid dropping the proc lock and parent proc lock after notifying other processes of our exit via kevent(2) or SIGCHLD but before setting PRS_ZOMBIE. As a result, if the other process tried to do a waitpid(W_NOHANG) during that window, it wouldn't see the process as a zombie yet and would fail. Affected files ... .. //depot/projects/smpng/sys/kern/kern_exit.c#122 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_exit.c#122 (text+ko) ==== @@ -406,6 +406,16 @@ sx_xunlock(&allproc_lock); /* + * Call machine-dependent code to release any + * machine-dependent resources other than the address space. + * The address space is released by "vmspace_exitfree(p)" in + * vm_waitproc(). + */ + cpu_exit(td); + + WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); + + /* * Reparent all of our children to init. */ sx_xlock(&proctree_lock); @@ -484,22 +494,6 @@ else /* LINUX thread */ psignal(p->p_pptr, p->p_sigparent); } - PROC_UNLOCK(p->p_pptr); - PROC_UNLOCK(p); - - /* - * Finally, call machine-dependent code to release the remaining - * resources including address space. - * The address space is released by "vmspace_exitfree(p)" in - * vm_waitproc(). - */ - cpu_exit(td); - - WITNESS_WARN(WARN_PANIC, &proctree_lock.lock_object, - "process (pid %d) exiting", p->p_pid); - - PROC_LOCK(p); - PROC_LOCK(p->p_pptr); sx_xunlock(&proctree_lock); /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705101528.l4AFSM8A016562>