Date: Fri, 27 May 2016 15:34:25 -0500 From: Eric van Gyzen <vangyzen@FreeBSD.org> To: Mateusz Guzik <mjguzik@gmail.com>, freebsd-current@freebsd.org Subject: Re: [PATCH] microoptimize locking primitives by avoiding unnecessary atomic ops Message-ID: <84b595b1-7fb4-efd9-dc2f-9faac90da1e0@FreeBSD.org> In-Reply-To: <20160527191700.GA23039@dft-labs.eu>
index | next in thread | previous in thread | raw e-mail
On 05/27/16 02:17 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. This makes sense to me, and the patch looks good. Please consider adding a comment to each location that explains why the extra condition is tested before the atomic op. Without such a comment, I am concerned that your changes will be garbage collected later, because the extra condition would seem superfluous to someone less familiar with the code. Erichome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?84b595b1-7fb4-efd9-dc2f-9faac90da1e0>
