Messages in this thread | | | Date | Sat, 22 Nov 2014 16:47:04 -0800 | From | Shaohua Li <> | Subject | Re: [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
| |