Date: Wed, 8 Aug 2018 17:48:03 +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-11@freebsd.org Subject: svn commit: r337470 - stable/11/sys/kern Message-ID: <201808081748.w78Hm3w7008266@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Wed Aug 8 17:48:02 2018 New Revision: 337470 URL: https://svnweb.freebsd.org/changeset/base/337470 Log: MFC r335183: proc0_post: Fix some locking issues Modified: stable/11/sys/kern/init_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/init_main.c ============================================================================== --- stable/11/sys/kern/init_main.c Wed Aug 8 17:32:02 2018 (r337469) +++ stable/11/sys/kern/init_main.c Wed Aug 8 17:48:02 2018 (r337470) @@ -632,17 +632,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?201808081748.w78Hm3w7008266>