From owner-svn-src-head@FreeBSD.ORG Sat Mar 21 20:25:35 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0AAE99B; Sat, 21 Mar 2015 20:25:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCDA977D; Sat, 21 Mar 2015 20:25:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2LKPZN6011586; Sat, 21 Mar 2015 20:25:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2LKPZCC011585; Sat, 21 Mar 2015 20:25:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201503212025.t2LKPZCC011585@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 21 Mar 2015 20:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280332 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2015 20:25:36 -0000 Author: mjg Date: Sat Mar 21 20:25:34 2015 New Revision: 280332 URL: https://svnweb.freebsd.org/changeset/base/280332 Log: proc: use MTX_NEW flag in proc_init This allows us to get rid of bzero which was added specifically to make mtx_init on p_mtx reliable. This also fixes a potential problem where mtx_init on other mutexes could trip over on unitialized memory and fire an assertion. Reviewed by: kib Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sat Mar 21 20:24:54 2015 (r280331) +++ head/sys/kern/kern_proc.c Sat Mar 21 20:25:34 2015 (r280332) @@ -225,12 +225,11 @@ proc_init(void *mem, int size, int flags p = (struct proc *)mem; SDT_PROBE(proc, kernel, init, entry, p, size, flags, 0, 0); p->p_sched = (struct p_sched *)&p[1]; - bzero(&p->p_mtx, sizeof(struct mtx)); - mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); - mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN); - mtx_init(&p->p_statmtx, "pstatl", NULL, MTX_SPIN); - mtx_init(&p->p_itimmtx, "pitiml", NULL, MTX_SPIN); - mtx_init(&p->p_profmtx, "pprofl", NULL, MTX_SPIN); + mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW); + mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_NEW); + mtx_init(&p->p_statmtx, "pstatl", NULL, MTX_SPIN | MTX_NEW); + mtx_init(&p->p_itimmtx, "pitiml", NULL, MTX_SPIN | MTX_NEW); + mtx_init(&p->p_profmtx, "pprofl", NULL, MTX_SPIN | MTX_NEW); cv_init(&p->p_pwait, "ppwait"); cv_init(&p->p_dbgwait, "dbgwait"); TAILQ_INIT(&p->p_threads); /* all threads in proc */