From: Ira Weiny <ira.weiny@intel.com>
To: Roman Gushchin <guro@fb.com>
Cc: Dennis Zhou <dennis@kernel.org>,
linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>,
Tejun Heo <tj@kernel.org>, Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [RESEND PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags
Date: Sun, 23 Feb 2020 06:32:23 -0800 [thread overview]
Message-ID: <20200223143222.GA29607@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20200222004656.GA459391@carbon.DHCP.thefacebook.com>
[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
next prev parent reply other threads:[~2020-02-23 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 23:16 ira.weiny
2020-02-21 23:56 ` Dennis Zhou
2020-02-22 0:46 ` Roman Gushchin
2020-02-23 14:32 ` Ira Weiny [this message]
2020-03-05 21:27 ` Dennis Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200223143222.GA29607@iweiny-DESK2.sc.intel.com \
--to=ira.weiny@intel.com \
--cc=dennis@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=guro@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®