Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2716660ybi; Mon, 17 Jun 2019 09:25:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd8D7NjgkF+CwrMUUkxxfuKXgreqW60c2aG6wVmiaNvC2/U4DBYkxTyZvOE8rK0fXd4bTx X-Received: by 2002:a65:490f:: with SMTP id p15mr49715717pgs.275.1560788743134; Mon, 17 Jun 2019 09:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560788743; cv=none; d=google.com; s=arc-20160816; b=0/av2aBYzK2myCZtfYa7JzQ/iSDOSwM7deGWmWW/BQmIUywO6p/vznBjARagxectV1 QWijtQQsQzs2UXIvM4eAtUzyItFSNxPVXe6hkY6kJTpPK18/jgMok+sBq+U8aDj90ReE b8eR22tn2J/YEve41HuyDYUA6IbGZvN50DyBcLP8dtY7o1Hp5xLAHIUq7oIy8BnhZYaA /HSbOVCePdgL/kSc51ihEZHONTRPsFGO9X7YyIxcYINUJc6pbEYlkzhLKpwcKIL4n7fF bquzR6ZUNMfJbF80KvjOTHkrOUyApWAd9dyv/tw1ZcAYD+c1nvaRFsDkqJEi8yq9kygx xw4w== 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; bh=PXluhcTCTbRu7MWWqjlNoU2J2WlclfBp1+lbYvichwE=; b=JFBL5iLo5MTTv15zZqDwyXMB+mOnzPng/OcxT4Ugf8ORxpYyorvGwq5sBOlxRmW9on WvEOo90Fm8CF7x1FGn+UZ5GhcDpL8jhY9XzwgJJJHb3qyQMdQZplxf+3qzqwcm3LSGpr zP4Vep9Jr0AskEPvdzd5fFzjoXg8OVHGNzO/pAiMgvC8hM/FUIsrH0hjqWHP48/OS2Wl djWP/cD6mkPU12No6mxrOk848z15hfwr8UNZBFNyjumGsUCzum1b5O4TyWSLas1/hA+S kYnVPn4ofZ02iyoDv7hI2j15sUWlwhfX32VVaFtnuZojZlk0IXLR747c74CQwJ6b3A89 xFgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NrVMIU4F; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p190si7509094pfp.266.2019.06.17.09.25.27; Mon, 17 Jun 2019 09:25:43 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NrVMIU4F; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbfFQQZQ (ORCPT + 99 others); Mon, 17 Jun 2019 12:25:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:35502 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbfFQQZQ (ORCPT ); Mon, 17 Jun 2019 12:25:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PXluhcTCTbRu7MWWqjlNoU2J2WlclfBp1+lbYvichwE=; b=NrVMIU4FjkXaOiq8EBdBsisYX RPTIEzflV5zzQh/U2sftmMWhHn06EA8gVxhHQI09wAKbG1YY/aylBwEQE3x3HBwdn0p4zMqAk5Mo8 Mvga3SN32GaMtRhAnUBUhndqL+MxsHwNGkAS3M0CB357M+Invewv0tSVMt+X2l3KOM45BTbbhqnDt 1+++Y1sYLNcIANFQDfBUusVnW+IoqYMTzumlNSNAxUdtCv1NiresC8d9lLN1vOGTCgavANJXprh0g Ycsi9s+FlfSM4Wn38hFtg0KP3TV8Cxgna/sKWsWO2eGeM2ZxuvI/tX2zz3ee6gP63a/gt8MV8ySJJ snbxbH0mw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hcuRE-0000rQ-MP; Mon, 17 Jun 2019 16:24:56 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 366F52076F712; Mon, 17 Jun 2019 18:24:55 +0200 (CEST) Date: Mon, 17 Jun 2019 18:24:55 +0200 From: Peter Zijlstra To: David Howells Cc: Jann Horn , Greg KH , Al Viro , raven@themaw.net, linux-fsdevel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module , kernel list , Kees Cook , Kernel Hardening Subject: Re: [PATCH 1/7] General notification queue with user mmap()'able ring buffer Message-ID: <20190617162455.GL3436@hirez.programming.kicks-ass.net> References: <20190528162603.GA24097@kroah.com> <155905930702.7587.7100265859075976147.stgit@warthog.procyon.org.uk> <155905931502.7587.11705449537368497489.stgit@warthog.procyon.org.uk> <4031.1559064620@warthog.procyon.org.uk> <20190528231218.GA28384@kroah.com> <31936.1559146000@warthog.procyon.org.uk> <16193.1559163763@warthog.procyon.org.uk> <21942.1559304135@warthog.procyon.org.uk> <606.1559312412@warthog.procyon.org.uk> <15401.1559322762@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15401.1559322762@warthog.procyon.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 31, 2019 at 06:12:42PM +0100, David Howells wrote: > Peter Zijlstra wrote: > > > > > (and it has already been established that refcount_t doesn't work for > > > > usage count scenarios) > > > > > > ? > > > > > > Does that mean struct kref doesn't either? > > > > Indeed, since kref is just a pointless wrapper around refcount_t it does > > not either. > > > > The main distinction between a reference count and a usage count is that > > 0 means different things. For a refcount 0 means dead. For a usage count > > 0 is merely unused but valid. > > Ah - I consider the terms interchangeable. > > Take Documentation/filesystems/vfs.txt for instance: > > dget: open a new handle for an existing dentry (this just increments > the usage count) > > dput: close a handle for a dentry (decrements the usage count). ... > > ... > > d_lookup: look up a dentry given its parent and path name component > It looks up the child of that given name from the dcache > hash table. If it is found, the reference count is incremented > and the dentry is returned. The caller must use dput() > to free the dentry when it finishes using it. > > Here we interchange the terms. > > Or https://www.kernel.org/doc/gorman/html/understand/understand013.html > which seems to interchange the terms in reference to struct page. Right, but we have two distinct set of semantics, I figured it makes sense to have two different names for them. Do you have an alternative naming scheme we could use? Or should we better document our distinction between reference and usage count?