git: kernel: Don't disturb about-to-be reaped zombies.

YONETANI Tomokazu y0n3t4n1 at gmail.com
Sun May 29 02:05:52 PDT 2011


On Sat, May 28, 2011 at 11:14:56AM -0700, Matthew Dillon wrote:
> 
> :commit 9458c398c0b97d30032a6541f8ab452cd93f5a86
> :Author: YONETANI Tomokazu <y0netan1 at dragonflybsd.org>
> :Date:   Fri May 27 22:27:39 2011 +0900
> :
> :    kernel: Don't disturb about-to-be reaped zombies.
> :    
> :    Processes in zombproc with p_nthreads == 0 are about to be reaped,
> :    so just leave them in peace.
> :    
> :    Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1996>
				:
>     I'm not sure about that.  nthreads == 0 should just mean that the
>     process's threads have all exited, not that the zombie process is
>     about to be reaped by a wait*() call.  It will probably be reaped
>     soon, but not necessarily... it depends on when the user process
>     actually calls wait*().
> 
>     What we might have to do instead is add another process flag, say
>     PREAPING, which would be set in kern_wait() somewhere around line
>     838 (just after it gets p->p_token).  Even then we might want it
>     to show up in the ps in case it gets stuck during the exit, so it
>     isn't an invisible stuck process.

Adding the process flag and using it is easy.  But to make those processes
show up in the ps with P_REAPING set, you need to let sysctl_kern_proc()
call sysctl_out_proc(p) on them while holding p->p_lock, which eventually
breaks the assertion on kern_exit.c:901 (KKASSERT(p->p_lock == 0)).

So, back to the original question in issue1996 (well, actually I asked that
in the second post, not the first one :), can we simply drop this assertion
(and let proc_remove_zombie() wait for p->p_lock to drop)?

Best Regards,
YONETANI Tomokazu.





More information about the Commits mailing list