lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200305212718.GA79730@dennisz-mbp.dhcp.thefacebook.com>
Date:   Thu, 5 Mar 2020 16:27:18 -0500
From:   Dennis Zhou <dennis@...nel.org>
To:     Ira Weiny <ira.weiny@...el.com>
Cc:     Roman Gushchin <guro@...com>, Dennis Zhou <dennis@...nel.org>,
        linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>,
        Tejun Heo <tj@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>
Subject: Re: [RESEND PATCH] percpu_ref: Fix comment regarding percpu_ref_init
 flags

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ