From owner-svn-src-head@FreeBSD.ORG Tue Nov 17 18:44:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27BF7106566B; Tue, 17 Nov 2009 18:44:50 +0000 (UTC) (envelope-from jilles@crab.stack.nl) Received: from crab.stack.nl (crab.stack.nl [131.155.140.134]) by mx1.freebsd.org (Postfix) with ESMTP id DFB408FC1B; Tue, 17 Nov 2009 18:44:49 +0000 (UTC) Received: by crab.stack.nl (Postfix, from userid 1677) id 093FE5C53; Tue, 17 Nov 2009 19:25:02 +0100 (CET) Date: Tue, 17 Nov 2009 19:25:01 +0100 From: Jilles Tjoelker To: Dmitry Pryanishnikov Message-ID: <20091117182501.GA70742@stack.nl> References: <4B01E548.7040708@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B01E548.7040708@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edwin Groothuis Subject: Re: svn commit: r194783 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 17 Nov 2009 18:44:50 -0000 On Tue, Nov 17, 2009 at 01:50:32AM +0200, Dmitry Pryanishnikov wrote: > > Author: edwin > > Date: Tue Jun 23 22:28:44 2009 > > New Revision: 194783 > > URL: http://svn.freebsd.org/changeset/base/194783 > > Log: > > Remove duplicate if-statement on gmt_is_set in gmtsub(). > > MFC after: 1 week > > Modified: > > head/lib/libc/stdtime/localtime.c > This change looks like a (small?) pessimization to me: before it, > _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set > == TRUE (all invocations except the first one), now it won't. I'm not > sure whether this is critical here though... It is certainly less efficient, but the old code was (most likely) wrong. It used an idiom known as "double checked locking", which is incorrect in most memory models. The problem is that the store to gmt_is_set may become visible without stores to other memory (gmtptr and what it points to) becoming visible. -- Jilles Tjoelker