process shared robust mutexes for tdb

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Dec 25 03:31:57 MST 2012

On Mon, Dec 24, 2012 at 09:43:07AM -0500, Ira Cooper wrote:
> Mutexes over mmap is actually fairly portable.  It is the robust mutexes
> over mmap that become less so.  But even then, I know 2 platforms that
> support them.  The Solaris/illumos family, and Linux.  That's not TOO bad.

There seems to be code in FreeBSD for that as well. Not sure
if it's released yet though.

> The numbers he's showing are not that unrealistic at all.  I've ran similar
> benchmarks.  The ability to decrease the cost of the locking primitives,
> and potentially avoid the context switch is pretty darn big.
> If you are wondering about "Why not transactions" look at my tdb.git and
> the locking branch.  The work is incomplete, and I'll admit a mess, in an
> attempt to make transactions work.  Volker wisely chose against this
> approach.  (Or he had the benefit of reading my disaster.  One of the two!)
> My only comment is: Volker, how are you handling "record" locking and not
> chain locking?  That was one part I never got 100% right.  (And on solaris
> using a mutex for everything is going to make someone cry... probably me.)

This patchset does not do per-record locking. So you will
still see fcntl for traverse. It carefully looks whether a
given lock offset/len is a lock for the freelist or
hashchain and falls back to fcntl if it does not match the
pattern. For me this is the most important use case.


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen, mailto:kontakt at

More information about the samba-technical mailing list