From owner-svn-src-user@FreeBSD.ORG Fri Nov 12 16:03:23 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A5CE1065670; Fri, 12 Nov 2010 16:03:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ED2598FC17; Fri, 12 Nov 2010 16:03:22 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8DF3D46B0C; Fri, 12 Nov 2010 11:03:22 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id ABF498A01D; Fri, 12 Nov 2010 11:03:21 -0500 (EST) From: John Baldwin To: Jilles Tjoelker Date: Fri, 12 Nov 2010 10:17:28 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201011100127.oAA1Rmrh069656@svn.freebsd.org> <20101112131941.GA57806@stack.nl> In-Reply-To: <20101112131941.GA57806@stack.nl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011121017.28819.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 12 Nov 2010 11:03:21 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, David Xu , svn-src-user@freebsd.org Subject: Re: svn commit: r215071 - in user/davidxu/libthr: include lib/libc lib/libc/gen lib/libc/stdio lib/libthr lib/libthr/thread X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 12 Nov 2010 16:03:23 -0000 On Friday, November 12, 2010 8:19:42 am Jilles Tjoelker wrote: > On Wed, Nov 10, 2010 at 01:27:48AM +0000, David Xu wrote: > > Author: davidxu > > Date: Wed Nov 10 01:27:48 2010 > > New Revision: 215071 > > URL: http://svn.freebsd.org/changeset/base/215071 > > > Log: > > Convert pthread_mutex_t and pthread_cond_t to structure based instead of > > pointer type, this allows us to support process-shared. > > Very nice. > > Apart from supporting process-shared, this also helps avoid the "array > of synchronization objects" anti-pattern (false sharing). It is not so > bad for the old struct pthread_mutex which is 64 bytes on i386, but in > other cases one cache line may contain parts of multiple unrelated > synchronization objects. > > In this regard, it would be better for stdio to allocate > struct { FILE file; pthread_mutex_t lock; } > rather than separate FILEs and locks. Note that stdio already does this. It currently expands 'pthread_mutex_t' to avoid namespace pollution in , but it does embed the pthread_mutex_t in FILE directly already. This does mean that changing pthread_mutex_t will change the ABI of FILE, but I think it is not an incompatible change as it should not affect the "public" fields accessed via macros. -- John Baldwin