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 ?

> +      */
> +     smp_mb();

smp_mb_before_atomic should be enough.

>       sbitmap_deferred_clear_bit(&sbq->sb, nr);

Thanks
Jianchao

Reply via email to