From owner-freebsd-current@freebsd.org Wed Jun 1 18:43:51 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 B0D0BB611CA for ; Wed, 1 Jun 2016 18:43:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8EE196F; Wed, 1 Jun 2016 18:43:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id q62so9273756wmg.3; Wed, 01 Jun 2016 11:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hkDCEJdLMGBs2LhM7ZieNoheq6jE2idUZwFaE77VUg0=; b=XEN+6JXMYehT2TZrnHd3wEaEjrvEIxFgbz4bKuJLQxOEoosGvfhlHdtTm9HNjJ8cn8 dKFIkkdJhaNRY07sHFWEP0DhtZ1WWlP3gecqD4Kg8KLHrX63Qy4Bv+f1OSun+rDDVGPE KQi16eo8XGyAmF477MjmW2fee6sJAi6HZfwy9IEVyAxgcWH/0lMSWzYaFAKKkBTioX12 P9PaH/bmJMAYiZsJAzk2mlqBcCShpvb3PRmk2rsXKOwLfYGGKEA63USeg93vPTKKWYCS 3MoLv8GwATm6clGxIqNaZwYcDBteECHDNGjehonug2fXH3qagfx2WwWqn0WkrVnEzrYC irww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=hkDCEJdLMGBs2LhM7ZieNoheq6jE2idUZwFaE77VUg0=; b=kz2G6xpsBaqboiLdoHQrzq5QaXdKPFuzsZ5bPEjjqIk+lfRtDaGP713aoNm8cH7i1D arcPmSTtXeWwCEs96ItK6714v71Xg82wVs9m3pXjr9qH3qCqQMlsVhIxKKtqoAwx1A8Y sDI8+Kscw3/f+zV4QznOXmqNUGCQuV5fMXr/mgJxNYJfk+5wKdGLPks9QWnCnwtWDmSs ZxQy3FLecRaXO5oCGCSHuauuoUimcBF3Dm+Lzb6mbDBCkfWnOlVydV4au5OBQ9Xrak3/ X1+rFEDIK1J8bA/gjiMjSi6u7a28qIG+JRtp2p2UIcml0sNTMBa7vJn3Okp6vrLoijoH UehA== X-Gm-Message-State: ALyK8tKdCXFLV2yqKDyyUQB6sDOvNofTKxwv2Dce3JBhRnrkj8J1cnXwYunz4K48WErUCw== X-Received: by 10.28.125.86 with SMTP id y83mr22090824wmc.8.1464806629407; Wed, 01 Jun 2016 11:43:49 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id c2sm36493101wme.4.2016.06.01.11.43.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 01 Jun 2016 11:43:48 -0700 (PDT) Date: Wed, 1 Jun 2016 20:43:46 +0200 From: Mateusz Guzik To: John Baldwin Cc: freebsd-current@freebsd.org Subject: Re: [PATCH] microoptimize locking primitives by avoiding unnecessary atomic ops Message-ID: <20160601184346.GA14712@dft-labs.eu> Mail-Followup-To: Mateusz Guzik , John Baldwin , freebsd-current@freebsd.org References: <20160527191700.GA23039@dft-labs.eu> <1588845.bSUmdZtqRF@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1588845.bSUmdZtqRF@ralph.baldwin.cx> User-Agent: Mutt/1.5.21 (2010-09-15) 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: Wed, 01 Jun 2016 18:43:51 -0000 On Fri, May 27, 2016 at 04:21:11PM -0700, John Baldwin wrote: > 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. > Thanks, committed in https://svnweb.freebsd.org/changeset/base/301157 -- Mateusz Guzik