Re: [PATCH 1/3] virthread: Introduce virRWLockInitPreferWriter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 24, 2017 at 01:12:59PM -0400, John Ferlan wrote:
> 
> 
> On 07/19/2017 10:31 AM, Michal Privoznik wrote:
> > We already have virRWLockInit. But this uses pthread defaults
> > which prefer reader to initialize the RW lock. This may lead to
> > writer starvation. Therefore we need to have the counterpart that
> > prefers writers. Now, according to the
> > pthread_rwlockattr_setkind_np() man page setting
> > PTHREAD_RWLOCK_PREFER_WRITER_NP attribute is no-op. Therefore we
> > need to use PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
> > attribute. So much for good enum value names.
> > 
> > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> > ---
> >  src/libvirt_private.syms |  1 +
> >  src/util/virthread.c     | 35 +++++++++++++++++++++++++++++++++++
> >  src/util/virthread.h     |  1 +
> >  3 files changed, 37 insertions(+)
> > 
> 
> This has broken the CI build, freebsd is not happy:
> 
> ../../src/util/virthread.c:133:42: error: use of undeclared identifier
> 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP'
>     pthread_rwlockattr_setkind_np(&attr,
> PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
>                                          ^
> 1 error generated.

It is not just FreeBSD, it also breaks OS-X and Win32.

The suffix '_np' / '_NP' is shorthand for nNon portable" - these
are glibc inventions. IMHO we should not really use this in our
code as if we're going to make assumptions that writers are not
starved as a result, because writers will be starved on any
non-Linux platform.

IOW, I think we need to just revert this.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux