From owner-freebsd-current@freebsd.org Fri May 27 23:21:35 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F583B4D009 for ; Fri, 27 May 2016 23:21:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23F631C3E for ; Fri, 27 May 2016 23:21:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C48DEB91E; Fri, 27 May 2016 19:21:33 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Cc: Mateusz Guzik Subject: Re: [PATCH] microoptimize locking primitives by avoiding unnecessary atomic ops Date: Fri, 27 May 2016 16:21:11 -0700 Message-ID: <1588845.bSUmdZtqRF@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160527191700.GA23039@dft-labs.eu> References: <20160527191700.GA23039@dft-labs.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 27 May 2016 19:21:33 -0400 (EDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 23:21:35 -0000 On Friday, May 27, 2016 09:17:01 PM Mateusz Guzik wrote: > Hello there, > > quite some time ago I posted a trivial patch to locking primitives. What > they do is the inline part tries an atomic op and if that fails the > actual function is called, which immediately tries the same op. > > The obvious optimisation checks for the availability of the lock first. > > There concerns about the way it was done previously by relying on > volatile behaving in a specific way. > > Later a simplified version was posted which should not have the concern, > but the thread died. > > I refer you to https://lists.freebsd.org/pipermail/freebsd-current/2015-November/058100.html > for simple benchmark results. > > I would like to get the patch in before 11 freeze. I think this looks fine. Thanks for expanding the previous patch to cover more primitives. -- John Baldwin