Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern For processes marked with PS_STOPEXIT, update the p...



details:   https://anonhg.NetBSD.org/src/rev/8d804c27b732
branches:  trunk
changeset: 340950:8d804c27b732
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Oct 13 00:28:22 2015 +0000

description:
For processes marked with PS_STOPEXIT, update the process's p_waited
value, and update its parent's p_nstopchild value when marking the
process's p_stat to SSTOP.  The process needed to be SACTIVE to get
here, so this transition represents an additional process for which
the parent needs to wait.

Fixes PR kern/50308

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2

diffstat:

 sys/kern/kern_exit.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 971a7faae3a2 -r 8d804c27b732 sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Tue Oct 13 00:27:19 2015 +0000
+++ b/sys/kern/kern_exit.c      Tue Oct 13 00:28:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.246 2015/10/13 00:27:19 pgoyette Exp $ */
+/*     $NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.246 2015/10/13 00:27:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 pgoyette Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -227,8 +227,15 @@
        if (__predict_false(p->p_sflag & PS_STOPEXIT)) {
                KERNEL_UNLOCK_ALL(l, &l->l_biglocks);
                sigclearall(p, &contsigmask, &kq);
+
+               if (!mutex_tryenter(proc_lock)) {
+                       mutex_exit(p->p_lock);
+                       mutex_enter(proc_lock);
+                       mutex_enter(p->p_lock);
+               }
                p->p_waited = 0;
-               membar_producer();
+               p->p_pptr->p_nstopchild++;
+               mutex_exit(proc_lock);
                p->p_stat = SSTOP;
                lwp_lock(l);
                p->p_nrlwps--;



Home | Main Index | Thread Index | Old Index