Re: [PATCH v2] rwlock: prevent readers from starving writers

2022-10-03 Thread David Marchand
On Tue, Jul 19, 2022 at 10:28 PM Stephen Hemminger wrote: > > Modify reader/writer lock to avoid starvation of writer. The previous > implementation would cause a writer to get starved if readers kept > acquiring the lock. The new version uses an additional bit to indicate > that a writer is wai

RE: [PATCH v2] rwlock: prevent readers from starving writers

2022-07-19 Thread Morten Brørup
> 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->cn

Re: [PATCH v2] rwlock: prevent readers from starving writers

2022-07-19 Thread Stephen Hemminger
> > /** > > @@ -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); > >

RE: [PATCH v2] rwlock: prevent readers from starving writers

2022-07-19 Thread Morten Brørup
> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Tuesday, 19 July 2022 22.28 > > Modify reader/writer lock to avoid starvation of writer. The previous > implementation would cause a writer to get starved if readers kept > acquiring the lock. The new version uses an additiona

[PATCH v2] rwlock: prevent readers from starving writers

2022-07-19 Thread Stephen Hemminger
Modify reader/writer lock to avoid starvation of writer. The previous implementation would cause a writer to get starved if readers kept acquiring the lock. The new version uses an additional bit to indicate that a writer is waiting and which keeps readers from starving the writer. Signed-off-by