lkml.org 
[lkml]   [2018]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] percpu-refcount: relax limit on percpu_ref_reinit()
On Tue, Sep 11, 2018 at 06:48:36AM -0700, Tejun Heo wrote:
> Hello, Ming.
>
> On Tue, Sep 11, 2018 at 08:00:50AM +0800, Ming Lei wrote:
> > > > @@ -357,10 +349,11 @@ EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm);
> > > > void percpu_ref_reinit(struct percpu_ref *ref)
> > > > {
> > > > unsigned long flags;
> > > > + unsigned long __percpu *percpu_count;
> > > >
> > > > spin_lock_irqsave(&percpu_ref_switch_lock, flags);
> > > >
> > > > - WARN_ON_ONCE(!percpu_ref_is_zero(ref));
> > > > + WARN_ON_ONCE(__ref_is_percpu(ref, &percpu_count));
> > >
> > > Can you elaborate this part? This doesn't seem required for the
> > > described change. Why is it part of the patch?
> >
> > The motivation of this patch is to avoid the above warning and allow
> > the ref to switch back to percpu mode without dropping to zero.
> >
> > That is why the check has to be changed to the above way.
>
> So, this part seems wrong. The function is called percpu_ref_reinit()
> - the refcnt is expected to be in its initial state with just the base
> ref once this function returns. If you're removing the restriction on

But the comment says that 'Re-initialize @ref so that it's in the same
state as when it finished', and this invariant isn't changed with this
patch.

> when this can be called, you should also make sure that the function
> actually enforces the target state. Also, this is a separate logical
> change, please put it in a separate patch.

OK, will do it in V2.

Thanks,
Ming

\
 
 \ /
  Last update: 2018-09-11 17:47    [W:0.061 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site