Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Aug 2018 17:49:35 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r337471 - stable/10/sys/kern
Message-ID:  <201808081749.w78HnZi4008372@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Wed Aug  8 17:49:35 2018
New Revision: 337471
URL: https://svnweb.freebsd.org/changeset/base/337471

Log:
  MFC r335183:
  
    proc0_post: Fix some locking issues

Modified:
  stable/10/sys/kern/init_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/init_main.c
==============================================================================
--- stable/10/sys/kern/init_main.c	Wed Aug  8 17:48:02 2018	(r337470)
+++ stable/10/sys/kern/init_main.c	Wed Aug  8 17:49:35 2018	(r337471)
@@ -611,17 +611,23 @@ proc0_post(void *dummy __unused)
 	 */
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
+		PROC_LOCK(p);
+		if (p->p_state == PRS_NEW) {
+			PROC_UNLOCK(p);
+			continue;
+		}
 		microuptime(&p->p_stats->p_start);
 		PROC_STATLOCK(p);
 		rufetch(p, &ru);	/* Clears thread stats */
-		PROC_STATUNLOCK(p);
 		p->p_rux.rux_runtime = 0;
 		p->p_rux.rux_uticks = 0;
 		p->p_rux.rux_sticks = 0;
 		p->p_rux.rux_iticks = 0;
+		PROC_STATUNLOCK(p);
 		FOREACH_THREAD_IN_PROC(p, td) {
 			td->td_runtime = 0;
 		}
+		PROC_UNLOCK(p);
 	}
 	sx_sunlock(&allproc_lock);
 	PCPU_SET(switchtime, cpu_ticks());



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808081749.w78HnZi4008372>