On Tue, 10 Jul 2018 09:59:58 -0700
Yipeng Wang <yipeng1.w...@intel.com> wrote:

> +
> +static inline void
> +__hash_rw_reader_lock(const struct rte_hash *h)
> +{
> +     if (h->readwrite_concur_support && h->hw_trans_mem_support)
> +             rte_rwlock_read_lock_tm(h->readwrite_lock);
> +     else if (h->readwrite_concur_support)
> +             rte_rwlock_read_lock(h->readwrite_lock);
> +}
> +
> +static inline void
> +__hash_rw_writer_unlock(const struct rte_hash *h)
> +{
> +     if (h->multi_writer_support && h->hw_trans_mem_support)
> +             rte_rwlock_write_unlock_tm(h->readwrite_lock);
> +     else if (h->multi_writer_support)
> +             rte_rwlock_write_unlock(h->readwrite_lock);
> +}
> +
> +static inline void
> +__hash_rw_reader_unlock(const struct rte_hash *h)
> +{
> +     if (h->readwrite_concur_support && h->hw_trans_mem_support)
> +             rte_rwlock_read_unlock_tm(h->readwrite_lock);
> +     else if (h->readwrite_concur_support)
> +             rte_rwlock_read_unlock(h->readwrite_lock);
> +}
> +

For small windows, reader-writer locks are slower than a spin lock
because there are more cache bounces.

Reply via email to