lkml.org 
[lkml]   [2014]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH percpu/for-3.18-fixes] percpu-ref: fix DEAD flag contamination of percpu pointer
On Sat, Nov 22, 2014 at 12:06:02PM -0500, Tejun Heo wrote:
> On Sat, Nov 22, 2014 at 09:04:48AM -0800, Shaohua Li wrote:
> ...
> > > + /*
> > > + * Theoretically, the following could test just ATOMIC; however,
> > > + * then we'd have to mask off DEAD separately as DEAD may be
> > > + * visible without ATOMIC if we race with percpu_ref_kill(). DEAD
> > > + * implies ATOMIC anyway. Test them together.
> > > + */
> > > + if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD))
> > > return false;
> >
> > this sounds not the correct answer. the DEAD/ATOMIC bit can be set by
> > percpu_ref_kill() right after the check.
>
> Yes, but that's why we're fetching @percpu_ptr with ACCESS_ONCE()
> before checking the flags.

Ok, I forgot we cache the percpu_ptr. Yes, this does work. You can add my
signed-off in the patch.

Thanks,
Shaohua


\
 
 \ /
  Last update: 2014-11-23 02:21    [W:0.045 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site