reap_kill_proc(): avoid singlethreading any other process if we are exiting

This is racy because curproc process lock is not used, but allows the
process to exit faster.  It is userspace issue to create such race
anyway, and not fullfilling the guarantee that all reaper descendants
are signalled should be fine.

In collaboration with:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D35310
This commit is contained in:
Konstantin Belousov 2022-05-17 02:47:20 +03:00
parent e0343eacf3
commit 1575804961

View File

@ -291,6 +291,7 @@ reap_kill_proc_locked(struct thread *td, struct proc *p2,
* race.
*/
need_stop = p2 != td->td_proc &&
(td->td_proc->p_flag2 & P2_WEXIT) == 0 &&
(p2->p_flag & (P_KPROC | P_SYSTEM | P_STOPPED)) == 0 &&
(rk->rk_flags & REAPER_KILL_CHILDREN) == 0;