libthr shared locks

Konstantin Belousov kostikbel at
Thu Feb 18 15:33:02 UTC 2016

On Wed, Feb 17, 2016 at 12:37:52PM -0500, Daniel Eischen wrote:
> On Wed, 17 Feb 2016, Konstantin Belousov wrote:
> > I do plan to introduce inlined objects (most likely in the form of
> > libthr2 initially, i.e. cc -D_LIBTHR2 -o file file.c -lthr2). But my
> > plans are to get the existing patch for pshared into the tree for 11.0.
> > After that I wanted to implement robust mutexes, still in the context of
> > the libthr. Then libthr2.
> As soon as this is done, will we build FreeBSD base OS against
> the new API?  So only ports would be affected.
I do not think this is feasible.  Base system does not have any significant
thread consumers, might be only ntpd qualifies.  Small things like ngctl
are not that important.

But base system provides C++ runtime for ports and I suspect that libc++
depends on the libthr ABI. Even jemalloc depends on libthr ABI. So
changing only the base ABI is probably impossible, from the first look
the switch like WITH_LIBTHR2_DEFAULT would be a flag day. Anyway, this
must be considered carefully during the later stage of the libthr2
development, right now it is rather empty speculation on my side.

> I was hoping to see partially inlined objects (with the first word
> being a pointer to the allocated object, just like now) in for 11.0.
> So by 12.0 we could make the switch over to fully inlined.
I do not see how this is realistic.

The issue of introducing the inlined objects is the stumbling block,
regardless of their use in full or only as a placeholder for the pointer.
Not even mentioning that we do not want to radically break the userspace
ABI for 11.0 when the freeze is so close, we would need much more time
to develop the WITH_LIBTHR2 alone.

This is my opinion, but it is supported by my experience.

> If we introduce either partially or fully inlined objects for 11.1
> (with your libthr2), how does that affect our ability to move to
> fully inlined by default (base & ports) for 12.0?  We would not
> have had a full release cycle for the ABI change.
I cannot answer this question, the issue requires careful investigation,
as I noted earlier in the message.  Might be I or somebody else would be
able to produce some trick that would ease the pain.  If not, the bump
of dso version numbers and dynamic linker awareness of the incompatible
libraries would be to coded.

> > Finishing the current patch for 11.0 is the immediate goal, while I did
> > not forget neither abandoned the inline alternative and do plan to work
> > on it.
That is.

More information about the freebsd-threads mailing list