From owner-svn-src-head@FreeBSD.ORG Wed Nov 18 03:51:34 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 A35F9106566B; Wed, 18 Nov 2009 03:51:34 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 62FF68FC13; Wed, 18 Nov 2009 03:51:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAI3l9g3049188; Tue, 17 Nov 2009 20:47:10 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 17 Nov 2009 20:47:32 -0700 (MST) Message-Id: <20091117.204732.1339398361.imp@bsdimp.com> To: lynx.ripe@gmail.com From: "M. Warner Losh" In-Reply-To: <4B01E548.7040708@gmail.com> References: <4B01E548.7040708@gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, edwin@FreeBSD.org 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: Wed, 18 Nov 2009 03:51:34 -0000 In message: <4B01E548.7040708@gmail.com> Dmitry Pryanishnikov writes: : : Hello! : : > 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 : > : > Modified: head/lib/libc/stdtime/localtime.c : > ============================================================================== : > --- head/lib/libc/stdtime/localtime.c Tue Jun 23 22:22:20 2009 (r194782) : > +++ head/lib/libc/stdtime/localtime.c Tue Jun 23 22:28:44 2009 (r194783) : > @@ -1472,18 +1472,16 @@ struct tm * const tmp; : > { : > register struct tm * result; : > : > + _MUTEX_LOCK(&gmt_mutex); : > if (!gmt_is_set) { : > - _MUTEX_LOCK(&gmt_mutex); : > - if (!gmt_is_set) { : : 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... I think this is a big pessimization. gmt_is_set code only needs to execute once, and this code was designed to be lockless once gmt_is_set was set... Warner