[PATCH 01/17] net/mana: add basic driver, build environment and doc

Stephen Hemminger stephen at networkplumber.org
Mon Jul 4 18:35:48 CEST 2022


On Sun, 3 Jul 2022 07:56:18 +0000
Long Li <longli at microsoft.com> wrote:

> > Subject: Re: [PATCH 01/17] net/mana: add basic driver, build environment and
> > doc
> > 
> > On Fri,  1 Jul 2022 02:02:31 -0700
> > longli at linuxonhyperv.com wrote:
> >   
> > > +	uint64_t max_mr_size;
> > > +	rte_rwlock_t	mr_list_lock;
> > > +};  
> > 
> > Reader/Writer locks are slower for the usual uncontended case.
> > Unless you have a reader holding onto the lock for a long time, better to use
> > spin lock.
> > 
> > This is Linux wisdom (thank you paulmck), Windows seems to love reader/writer
> > locks.  
> 
> This lock is used mostly uncontended for readers and allow them concurrently to access the list. It's rare that a writer might want to access it.
> 
> But changing it to spinlock will prevent multiple readers from accessing the list at the same time. In this use case, is it beneficial to use spinlocks?

It all depends on how long the readers and writers hold the lock.
If the window is short a spin lock is faster.


More information about the dev mailing list