On Tue, Mar 19, 2019 at 01:17:31PM +0800, jianchao.wang wrote:
> Hi Ming
>
> On 3/19/19 12:24 PM, Ming Lei wrote:
> > @@ -591,6 +591,15 @@ EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up);
> > void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
> > unsigned int cpu)
> > {
> > + /*
> > + * Once the clear bit is set, it will be visible to allocation
> > + * side.
> > + *
> > + * This memory barrier orders any READ/WRITE on the to-be-freed
> > + * asssociated instance for avoiding potential use-after-free, and
> > + * its pair is the memory barrier implied in sbitmap_get().
> which one ?
test_and_set_bit_lock() in __sbitmap_get_word().
>
> > + */
> > + smp_mb();
>
> smp_mb_before_atomic should be enough.
Right, will change to it in V2.
Thanks,
Ming