> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Wednesday, 20 July 2022 00.34
> 
> > >  /**
> > > @@ -179,7 +226,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
> > >  static inline void
> > >  rte_rwlock_write_unlock(rte_rwlock_t *rwl)
> > >  {
> > > - __atomic_store_n(&rwl->cnt, 0, __ATOMIC_RELEASE);
> > > + __atomic_fetch_sub(&rwl->cnt, RTE_RWLOCK_WRITE,
> > > __ATOMIC_RELEASE);
> >
> > Yes. This is correct, regardless if another writer thread is waiting
> or not. (Reviewed for one writer thread using rte_rwlock_write_lock()
> and another using rte_rwlock_write_trylock().)
> >
> 
> Was trying to stick to original logic.
> 
> After writer releases want both writer and reader to be able to get in
> equally.
> This provide a measure of fairness (no preference) so writers can't
> starve readers either.

OK; I was thinking that writers had preference. I was about to request you to 
document this somewhere, but you already noted it above the link to the link to 
the Lockless Inc. article.

I didn't review the __ATOMIC_ACQUIRE/RELEASE/RELAXED access modes, but all 
other aspects look good.

Reviewed-by: Morten Brørup <m...@smartsharesystems.com>

Reply via email to