Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1435226ybv; Sun, 23 Feb 2020 06:37:33 -0800 (PST) X-Google-Smtp-Source: APXvYqz7czKPgQPH3Woe2EN6e3qo7/QMRmLVdK3p+hLyalj5piLVN8RVt5QrtR0SefRSvCdBC1w/ X-Received: by 2002:a9d:7593:: with SMTP id s19mr34885479otk.219.1582468653680; Sun, 23 Feb 2020 06:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582468653; cv=none; d=google.com; s=arc-20160816; b=IGGAXxYOANaz93iYYqVBPI13sSCoJ0MWEXM+KfJqpYYmO8DQWhYlWiViMRHSCaL0tS e7Hyylz4WJGLHZpJ2rlFqQ/r8SK5bUXJrXJkSc38gYy/bayPT2eu2aci2WykgU2pS/qB UZ5iCV/oabW+Xe3gcRiXO17zIQisUskntP/0WY+y9B3SJikOBWa0urpRDcIOYLzfxwZY GUKDpbj3Gno3jn4jP61L9il0BkTMDU+69/Ll+i29EZ6ItwaiMAX4FYncUXqlCdhGZmtV 0GhjMCta+z4/7JOwZ4umCiACTFnPMWmvsAjyEa6WjFV6X3/+jDRAUS6OtVazNDb4YOd9 bNGg== 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=arZj/6+s4bqLc5TtgLKQbJLlysZMpYNMbzD04v1DCkc=; b=dVb76HLuhyrvZ2JaodLspBVRVsxP1hnAMFPJoqA1oioi52yDyvasqVlqclq1nkp+FH bsrc+86VJDwglyJhqvAiUpcRW90pmAVLtUoiTYGsbeZNhqgQSmYJNuztQzi2yRh8zLCZ 48xcWzMTtXoFmCsqKA36NVRoqFiwa7gIxazxIrwoyaJuyHDyEJMLC7QPixXFCFqvn5sA dqj/PvI6OgiG3UyscFQduPQZJAoRdJYaRX7tpssdtpxSL22BjjVw/drrCweFDszvzGwn VNVPGY7doDCppXgNecil05IBv09jkoEFg2LLE1cwx2yCUzHgAage2nZMJ2K5+4Wh4NsA NF3Q== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si6284593ots.78.2020.02.23.06.37.21; Sun, 23 Feb 2020 06:37:33 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbgBWOcY (ORCPT + 99 others); Sun, 23 Feb 2020 09:32:24 -0500 Received: from mga09.intel.com ([134.134.136.24]:56097 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbgBWOcY (ORCPT ); Sun, 23 Feb 2020 09:32:24 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2020 06:32:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,476,1574150400"; d="scan'208";a="437447468" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga006.fm.intel.com with ESMTP; 23 Feb 2020 06:32:23 -0800 Date: Sun, 23 Feb 2020 06:32:23 -0800 From: Ira Weiny To: Roman Gushchin Cc: 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: <20200223143222.GA29607@iweiny-DESK2.sc.intel.com> References: <20200221231607.12782-1-ira.weiny@intel.com> <20200221235627.GA59628@dennisz-mbp.dhcp.thefacebook.com> <20200222004656.GA459391@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200222004656.GA459391@carbon.DHCP.thefacebook.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [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