Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4396100imm; Fri, 18 May 2018 04:32:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrUXe4wz2/vOka57CbssF1RJZAV6OdsF+idoIpV4OdDpurPVlPbnE0Aqj8z4Ml5+W9zk6C5 X-Received: by 2002:a62:a21e:: with SMTP id m30-v6mr9109495pff.251.1526643167867; Fri, 18 May 2018 04:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526643167; cv=none; d=google.com; s=arc-20160816; b=B1g7vUBEt0wQlqh8jZII62ohVI7POBIJ9ec13auUCiFidvq7nOXiZcozWDTRpmdUeW B1ADtSkYSSraAB9hCYEDvcC3zFsqtcozS6XWcWAiky91XufqddAeSIdC/hyv7TtXXrpw +oe0jF7eb45yvAzgzhBAegH1Ifzor1iQDsQsMouhGlBAOIuLoMYfOs7f0oio5krHRTg3 R3X5rgaUrlpPN8PZxNMdtA537h3lPN8Xgz7RBayM1NJRcvdT+rstyAmqRbt6jRAkK/Ua acYlBhDpGizMAIDpl4z8WsUTGvckwqLZ9GDYEohtX7ina0OEzUkL/ULfjyVx8BhfxLM4 Oimw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=qUoDPqWRIHYFCgOLnp04td2Ape81Sb6G3HMp8Vo5dqw=; b=c3AFYaj6KJ01DeQm3tctmndnVncaWKmzR3BBudWbB+bf4YpWXnvJNMTG18dZr+TjHK 2IXQF20yf3GmGPXfoY3EBmYiMzqBHHNXV/aOaU0YGyDB1vEapV5XpLEtaPljusNgQjIb NqJCyNZ51+OPSQUEw2z57ChXB3h+KDhzu8NyL4v4vmkVUbBQpvkRhCtIkj/3UoPRVhbY EimQgPcb/82SQ2MbLZDPXvS+LkwftNi4cduiB46MyY97kD0rwmYpyOdzvdZuajMXoGOS RWJtb42LTn8Wo8x026Z2hB53KKezdGeMkTLy7mzts/D5FYAPf7Dtr8n6j6O1uf/zF+Gy UitA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=in/vdODa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si5911326pgo.662.2018.05.18.04.32.32; Fri, 18 May 2018 04:32:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=in/vdODa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbeERLcP (ORCPT + 99 others); Fri, 18 May 2018 07:32:15 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:42025 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbeERLcK (ORCPT ); Fri, 18 May 2018 07:32:10 -0400 Received: by mail-qt0-f194.google.com with SMTP id c2-v6so9767101qtn.9; Fri, 18 May 2018 04:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qUoDPqWRIHYFCgOLnp04td2Ape81Sb6G3HMp8Vo5dqw=; b=in/vdODafYBNEuohiV0rxkrK1m9qOKZ1h8tcYDGDVhKoGtdW9UKGIMDS1NAt1PdkTB vEW8m/FJ1FeJNbGq+x/pZUNffiwf74SPSp1YiEV9c1GkORiu1hxpyzLkNKk8gVP6oQdF E5YNkcLv4tGD84hATKs8nELZ/GLP/G5Uzoei90U5VDDCIGOeEGB9DHQQsxpziriV+9y1 6Aft08UguNM3UGYANzOXesQbs0F1t2VplE2CywvAqQN2uURCSWa5Ll3W6N/iXxctOG6f mx07gTFR77Zgo/8fUif6eCMuILX65zE8c3E4MvfSxKzXQpQ4sQ+UEQ8zco9nyzBVVIK9 DJqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qUoDPqWRIHYFCgOLnp04td2Ape81Sb6G3HMp8Vo5dqw=; b=gb6YnlPmyZRKSKaK7K7On1PDMWzPApfaKICBINlzY5OKLLWiXxkBWQaIFGAIHNJjO+ UlN7DCRKmipHdpq8UDDdTEsdV6JZUxhHLLDJ4pDeYDjSzkrt4FQMTmEm0o3R1aABWUPt FF31qHDpxuY9/FZ6ngHeYYiyzKe1g9EW7a3wJsi8hSeNpi8A/BKvpjNEWyi9nGmKyArL Z36gJzjSLIBIfgHUmklfU38ZCy4thE6DUOsTw+xQfDMcROajZfTotieAoGjbO5ZzbSrA +tn4yCOlnkGegGH0JGBPTOYMYFL/Nd/qDNRHqhIMvv2S4aDwVY9MCY5Aahbp1E5BbtWe Ahng== X-Gm-Message-State: ALKqPwdqE4Sqsf/ayDliDIm8T/+zz4GvVosba6qdHSr3qpsiMCjx9PFz X8289vV0iVPvWvTyCKR1ZA== X-Received: by 2002:aed:3dbd:: with SMTP id i58-v6mr9007339qtf.34.1526643129291; Fri, 18 May 2018 04:32:09 -0700 (PDT) Received: from kmo-pixel (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id v189-v6sm5344637qka.79.2018.05.18.04.32.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 04:32:08 -0700 (PDT) Date: Fri, 18 May 2018 07:32:05 -0400 From: Kent Overstreet To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Dave Chinner , darrick.wong@oracle.com, tytso@mit.edu, linux-btrfs@vger.kernel.org, clm@fb.com, jbacik@fb.com, viro@zeniv.linux.org.uk, willy@infradead.org Subject: Re: [PATCH 04/10] locking: export osq_lock()/osq_unlock() Message-ID: <20180518113205.GA16943@kmo-pixel> References: <20180518074918.13816-1-kent.overstreet@gmail.com> <20180518074918.13816-9-kent.overstreet@gmail.com> <20180518095204.GF12217@hirez.programming.kicks-ass.net> <20180518101804.GB15403@kmo-pixel> <20180518110808.GH12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518110808.GH12217@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 18, 2018 at 01:08:08PM +0200, Peter Zijlstra wrote: > On Fri, May 18, 2018 at 06:18:04AM -0400, Kent Overstreet wrote: > > On Fri, May 18, 2018 at 11:52:04AM +0200, Peter Zijlstra wrote: > > > On Fri, May 18, 2018 at 03:49:06AM -0400, Kent Overstreet wrote: > > > > > > No.. and most certainly not without a _very_ good reason. > > > > Ok, can I ask why? > > Because it is an internal helper for lock implementations that want to > do optimistic spinning, it isn't a lock on its own and lacks several > things you would expect. > > Using it is tricky and I don't trust random module authors to get 1+1 > right, let alone use this thing correctly (no judgement on your code, > just in general). Yeah, that's true. I just modelled my usage on the rwsem code. It does strike me that the whole optimistic spin algorithm (mutex_optimistic_spin() and rwsem_optimistic_spin()) are ripe for factoring out. They've been growing more optimizations I see, and the optimizations mostly aren't specific to either locks. > > Here's what it's for: > > I'll try and have a look soon :-) But does that really _have_ to live in > a module? No, I'd be completely fine with moving six locks out of bcachefs, just don't know that there'd be any other users. But I suppose we do have other filesystems that use btrees, and that's what they're for.