Re: [PATCH percpu/for-3.18-fixes] percpu-ref: fix DEAD flag contamination of percpu pointer
From: Tejun Heo
Date: Sat Nov 22 2014 - 12:06:16 EST
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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/