[PATCH 01/17] net/mana: add basic driver, build environment and doc
Long Li
longli at microsoft.com
Tue Jul 5 21:50:27 CEST 2022
> Subject: Re: [PATCH 01/17] net/mana: add basic driver, build environment and
> doc
>
> 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?
>
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.re
> searchgate.net%2Ffigure%2FCosts-of-Simple-Spinlock-and-Distributed-Reader-
> Writer-Spinlock-To-write-acquire-
> the_fig1_244490342&data=05%7C01%7Clongli%40microsoft.com%7C51cc
> 3d29340347b87b8508da5ddc06c0%7C72f988bf86f141af91ab2d7cd011db47%7
> C1%7C0%7C637925496841806674%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
> 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C
> %7C%7C&sdata=bWePngCuLBWN%2FFasdYpTuuCJW6Y8kX6WVTInLYvd1E
> c%3D&reserved=0
>
> Conclusion
>
> Breakeven curves for the locking primitives were
> computed, and the breakeven between simple spinlock
> and distributed reader-writer spinlock supports the rule of
> thumb that states that simple spinlock should be used in
> cases where the update ratio f is greater than the
> reciprocal of the number of CPUs, 1/nm.
Thank you for the pointer!
I think this driver should use spinlocks. I'm sending v2 with this change.
Long
More information about the dev
mailing list