Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern - lwp_wait(): if the process is exiting and no prog...
details: https://anonhg.NetBSD.org/src/rev/77276979dafe
branches: trunk
changeset: 1006794:77276979dafe
user: ad <ad%NetBSD.org@localhost>
date: Mon Jan 27 21:58:16 2020 +0000
description:
- lwp_wait(): if the process is exiting and no progress is being made, wake
every clock tick and kick all the LWPs again.
- lwp_create(): copy the LW_WEXIT etc flags while holding the parent's
p_lock. Copy only LW_WREBOOT in the case of fork(), since a pending
coredump or exit() in the parent process isn't for the child.
diffstat:
sys/kern/kern_lwp.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diffs (59 lines):
diff -r 3cad0ffddc68 -r 77276979dafe sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c Mon Jan 27 21:30:17 2020 +0000
+++ b/sys/kern/kern_lwp.c Mon Jan 27 21:58:16 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lwp.c,v 1.221 2020/01/26 19:06:24 ad Exp $ */
+/* $NetBSD: kern_lwp.c,v 1.222 2020/01/27 21:58:16 ad Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -211,7 +211,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.221 2020/01/26 19:06:24 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.222 2020/01/27 21:58:16 ad Exp $");
#include "opt_ddb.h"
#include "opt_lockdebug.h"
@@ -653,8 +653,7 @@
*/
if (exiting) {
KASSERT(p->p_nlwps > 1);
- cv_wait(&p->p_lwpcv, p->p_lock);
- error = EAGAIN;
+ error = cv_timedwait(&p->p_lwpcv, p->p_lock, 1);
break;
}
@@ -662,9 +661,6 @@
* If all other LWPs are waiting for exits or suspends
* and the supply of zombies and potential zombies is
* exhausted, then we are about to deadlock.
- *
- * If the process is exiting (and this LWP is not the one
- * that is coordinating the exit) then bail out now.
*/
if ((p->p_sflag & PS_WEXIT) != 0 ||
p->p_nrlwps + p->p_nzlwps - p->p_ndlwps <= p->p_nlwpwait) {
@@ -839,7 +835,7 @@
l2->l_inheritedprio = -1;
l2->l_protectprio = -1;
l2->l_auxprio = -1;
- l2->l_flag = (l1->l_flag & (LW_WEXIT | LW_WREBOOT | LW_WCORE));
+ l2->l_flag = 0;
l2->l_pflag = LP_MPSAFE;
TAILQ_INIT(&l2->l_ld_locks);
l2->l_psrefs = 0;
@@ -921,6 +917,11 @@
} else
l2->l_prflag = 0;
+ if (l1->l_proc == p2)
+ l2->l_flag |= (l1->l_flag & (LW_WEXIT | LW_WREBOOT | LW_WCORE));
+ else
+ l2->l_flag |= (l1->l_flag & LW_WREBOOT);
+
l2->l_sigstk = *sigstk;
l2->l_sigmask = *sigmask;
TAILQ_INIT(&l2->l_sigpend.sp_info);
Home |
Main Index |
Thread Index |
Old Index