On 07/19/2017 10:31 AM, Michal Privoznik wrote:
> While this is not that critical (hash tables have O(1) time complexity for
> lookups), it lays down path towards making virDomainObj using RW locks instead
> of mutexes. Still, in my limited testing this showed slight improvement.
> 
> Michal Privoznik (3):
>   virthread: Introduce virRWLockInitPreferWriter
>   virobject: Introduce virObjectRWLockable
>   virdomainobjlist: Use virObjectRWLockable
> 
>  src/conf/virdomainobjlist.c |  24 ++++----
>  src/libvirt_private.syms    |   4 ++
>  src/util/virobject.c        | 144 
> ++++++++++++++++++++++++++++++++++----------
>  src/util/virobject.h        |  16 +++++
>  src/util/virthread.c        |  35 +++++++++++
>  src/util/virthread.h        |   1 +
>  6 files changed, 180 insertions(+), 44 deletions(-)
> 

This could be a "next step" in the work I've been doing towards a common
object:

https://www.redhat.com/archives/libvir-list/2017-June/msg00916.html

which moves all those driver/vir*obj list API's for Lookup, Search,
ForEach, Add, Remove, etc. into object code since they're essentially
all following the same pattern.

Once there - altering the Lockable lock under the covers should be
relatively simple. I would be called a ListLock or HashLock instead of
an RWLock and the implementation is such that it's R or W depending on
API. Taking a quick refresher look at the series, for a new object I
call virObjectLookupHashClass - that could be the integration point to
use a local initialization for the class and then the appropriate lock
style depending on API.

Just thinking off the cuff and of course trying to keep stuff I've been
working on fresh ;-)

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to