From owner-svn-src-user@FreeBSD.ORG Tue Oct 23 14:18:50 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1B8AD72; Tue, 23 Oct 2012 14:18:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B176C8FC12; Tue, 23 Oct 2012 14:18:50 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 16162B946; Tue, 23 Oct 2012 10:18:50 -0400 (EDT) From: John Baldwin To: Andre Oppermann Subject: Re: svn commit: r241889 - in user/andre/tcp_workqueue/sys: arm/arm cddl/compat/opensolaris/kern cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs ddb dev/acpica dev/... Date: Tue, 23 Oct 2012 08:53:56 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <201210221418.q9MEINkr026751@svn.freebsd.org> <20121023032743.K2804@besplex.bde.org> <508664C7.3080206@freebsd.org> In-Reply-To: <508664C7.3080206@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210230853.56549.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 23 Oct 2012 10:18:50 -0400 (EDT) Cc: src-committers@freebsd.org, Bruce Evans , svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2012 14:18:51 -0000 On Tuesday, October 23, 2012 5:35:03 am Andre Oppermann wrote: > On 22.10.2012 19:10, Bruce Evans wrote: > > On Mon, 22 Oct 2012, Andre Oppermann wrote: > > > >> Log: > >> Second pass at making global mutexes use MTX_DEF_SYSINIT(). > > > >> Modified: user/andre/tcp_workqueue/sys/arm/arm/busdma_machdep.c > >> ============================================================================== > >> --- user/andre/tcp_workqueue/sys/arm/arm/busdma_machdep.c Mon Oct 22 14:10:17 2012 (r241888) > >> +++ user/andre/tcp_workqueue/sys/arm/arm/busdma_machdep.c Mon Oct 22 14:18:22 2012 (r241889) > >> @@ -163,9 +163,7 @@ static TAILQ_HEAD(,bus_dmamap) dmamap_fr > >> #define BUSDMA_STATIC_MAPS 500 > >> static struct bus_dmamap map_pool[BUSDMA_STATIC_MAPS]; > >> > >> -static struct mtx busdma_mtx; > >> - > >> -MTX_SYSINIT(busdma_mtx, &busdma_mtx, "busdma lock", MTX_DEF); > >> +static MTX_DEF_SYSINIT(busdma_mtx, "busdma lock", MTX_DEF); > > > > The verboser (sic) name is uglier. > > > > But once it says DEF, the arg list shouldn't say DEF. Either this is > > DEF for something unrelated to MTX_DEF, in which case it is confusing > > and the confusion is made worse by having MTX_ precede DEF in both, > > or it is the same DEF and the arg is redundant, or it implies MTX_DEF > > by default but this can be changed, in which case it is confusing. > > You're right, it is a bit confusing. However the DEF in MTX_DEF_SYSINIT > stands for DEFining the global variable whereas MTX_DEF stands for a > default type mutex. > > Unfortunately I couldn't come up with a bette short name for MTX_DEF_SYSINIT. > I'm open for suggestions though. It's not super clear to me that having one macro to replace 'struct mtx and MTX_SYSINIT' is substantially more readable compared to just adding '__aligned(CACHE_LINE_SIZE)' at the end of global locks. Note, btw, that I have local patches to make mtx_pool's use aligned mutexes, but they have never shown a performance improvement in real-word benchmarks (granted, the last set of benchmarks were run several years ago (the patches are old) by kris@). OTOH, alc@ found a measurable boost by aligning a few global mutexes in the VM system. -- John Baldwin