Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6116774ybf; Thu, 5 Mar 2020 13:29:32 -0800 (PST) X-Google-Smtp-Source: ADFU+vtnBmjNItCybLd7cvV+Lpr8Dg0Du2W0wKq3Y7zJgLh59nRttlajFUVkLou6NAjS6gY//01C X-Received: by 2002:aca:b7d5:: with SMTP id h204mr337697oif.130.1583443772511; Thu, 05 Mar 2020 13:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583443772; cv=none; d=google.com; s=arc-20160816; b=J5ICKoYdjqq6Ad6OPWrMHerQQMz5AOjYu6FhPxhQCx9KMZujZyIWFIb0XARiv7PBV9 J9hpnby6R72HVTb9yy7cKSTuM9klsPZeM8GAfjzVftBTIbdP+559oE33pTru/KBMOk3C +0zp9q/LmokHgYKIPDDdrzet9ewMqNx/H5AGXJyu1DeCikd6sNl1yw8agjHfA6w4u3wp 8BSI6q1sa2Ybrf9R01DT1ZG+Kra61GReXrERsd1O7dLScydx+zC2YtBZCGyex7R5Fi8j ySJpne97KIZ90IET4ryUoxrSc76tpproU4LlcNU69jV/4tmwyH9bEk0zyOpWbVnpU5g4 mPOw== 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; bh=9K4pNKxCAagBBMJm2ftqWB6E4IhmeUAZc+AwmoD+QfY=; b=FKh6YUtnYJI4jri7IA7r/9Dd1lqQAyxzerRPBxzGp4tc0b9eA3VNRbOPvrv9aN9hW8 SeLU7B/6Kpx6zRBQFJXGmzsxi3jjnA1t9SKQdHje+ohzdHE1AntH7wXLRLkgqbBBeIhv y26s9BwNcrOQhdrbZSC8Pw/v8SGuQF1W80Hr7GOFTbB9CZ7Xf0MT3ODhkkCiX3ARQ5oY C7mJX7bOFbtfcsQi/MOyeEDXTLVUzUpr0pjdh41k64Yk3wGoD9RsOk3E97GLr2jO/he6 jWm9gn4gbNkYCNXR7H2e3JTYuYK5wKH4tW+2OC9lEoOj7FbyRPs71nS+aeU2+XGxTYPT aX0g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si101285otg.179.2020.03.05.13.29.20; Thu, 05 Mar 2020 13:29:32 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbgCEV1W (ORCPT + 99 others); Thu, 5 Mar 2020 16:27:22 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:43577 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgCEV1W (ORCPT ); Thu, 5 Mar 2020 16:27:22 -0500 Received: by mail-qv1-f67.google.com with SMTP id eb12so3128618qvb.10 for ; Thu, 05 Mar 2020 13:27:21 -0800 (PST) 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=9K4pNKxCAagBBMJm2ftqWB6E4IhmeUAZc+AwmoD+QfY=; b=OV9REuI3f16c9bO8tfKOSIbk8GH0XUI6o5hykP4CQ1y5UTlQ1bYfBN2IVlStbuBpxp ofdc7ZRECsoKSXc2h78qsz+O3GbmLn7tlv/IRRCoOVIBi6xuyS+B3sqPjmyP473nScea xwvxhvo+VmC09agCoZphQAh33K2CmJ0NSnRQFP35BQT9KhdmU1OduV4JLiqwK887EpIn M0Q0N/8iu3Vlov6Qaum3ya+zC5QrbAFdEqbkzLk6Owg7WpCaHmCmajfqTg+Wj7BeftB8 8ExBOkQYMaMmGqrDK4mR7kTAGbJ5nqDa5Is862HlLjVNhwrCTLHqNWuXBq28rW15fGwF RcCA== X-Gm-Message-State: ANhLgQ35ZszhvMKoU9MRGGXqusbof0sHJQhAHy3jJfhMHrT3/paZ+Z1U 2pIkDOOjhjIAVfgBtohTPHs9brT48NQ= X-Received: by 2002:a0c:a910:: with SMTP id y16mr244117qva.139.1583443641107; Thu, 05 Mar 2020 13:27:21 -0800 (PST) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:500::b9df]) by smtp.gmail.com with ESMTPSA id i91sm16814609qtd.70.2020.03.05.13.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 13:27:20 -0800 (PST) Date: Thu, 5 Mar 2020 16:27:18 -0500 From: Dennis Zhou To: Ira Weiny Cc: Roman Gushchin , Dennis Zhou , linux-kernel@vger.kernel.org, Petr Mladek , Tejun Heo , Thomas Gleixner , Greg Kroah-Hartman , Sakari Ailus Subject: Re: [RESEND PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags Message-ID: <20200305212718.GA79730@dennisz-mbp.dhcp.thefacebook.com> References: <20200221231607.12782-1-ira.weiny@intel.com> <20200221235627.GA59628@dennisz-mbp.dhcp.thefacebook.com> <20200222004656.GA459391@carbon.DHCP.thefacebook.com> <20200223143222.GA29607@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200223143222.GA29607@iweiny-DESK2.sc.intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 23, 2020 at 06:32:23AM -0800, Ira Weiny wrote: > > [snip] > > > > > diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c > > > > index 4f6c6ebbbbde..48d7fcff70b6 100644 > > > > --- a/lib/percpu-refcount.c > > > > +++ b/lib/percpu-refcount.c > > > > @@ -50,9 +50,9 @@ static unsigned long __percpu *percpu_count_ptr(struct percpu_ref *ref) > > > > * @flags: PERCPU_REF_INIT_* flags > > > > * @gfp: allocation mask to use > > > > * > > > > - * Initializes @ref. If @flags is zero, @ref starts in percpu mode with a > > > > - * refcount of 1; analagous to atomic_long_set(ref, 1). See the > > > > - * definitions of PERCPU_REF_INIT_* flags for flag behaviors. > > > > + * Initializes @ref. If @flags is zero or PERCPU_REF_ALLOW_REINIT, @ref starts > > > > + * in percpu mode with a refcount of 1; analagous to atomic_long_set(ref, 1). > > > > + * See the definitions of PERCPU_REF_INIT_* flags for flag behaviors. > > > > > > Yeah. Prior we had both PERCPU_REF_INIT_ATOMIC and PERCPU_REF_INIT_DEAD > > > with the latter implying the former. So 0 meant percpu and the others > > > meant atomic. With PERCPU_REF_ALLOW_REINIT, it's probably easier to > > > understand by saying if neither PERCPU_REF_INIT_ATOMIC or > > > PERCPU_REF_INIT_DEAD is set, it starts out in percpu mode which is > > > mentioned in the comments where the flags are defined. It's not great > > > having implied flags, but it's worked so far. > > > > > > Also, it's not quite analagous to atomic_long_set(ref, 1) as there is a > > > bias to prevent prematurely hitting 0. > > > > > > I can take this and massage the wording a bit. > > > > Hello Ira! Hello Dennis! > > > > Yeah, I'd simple say that it starts in the percpu mode, except the case when > > PERCPU_REF_INIT_ATOMIC is set, then (atomic mode, 1) and > > PERCPU_REF_INIT_DEAD is set, then (atomic mode, 0). > > > > PERCPU_REF_ALLOW_REINIT actually doesn't affect the initial state. > > > > Thanks for the clarification. Dennis let me know if you want me to resubmit > the patch. > > Thanks! > Ira > Sorry for the delay. I've applied it to for-5.7. Thanks, Dennis