fcntl spinlock in Linux?

J. Bruce Fields bfields at fieldses.org
Thu Jan 24 09:34:53 MST 2013


On Thu, Jan 24, 2013 at 04:06:33PM +0100, Volker Lendecke wrote:
> On Thu, Jan 24, 2013 at 02:05:00PM +0100, Stefan (metze) Metzmacher wrote:
> > > If that interpretation is right, then I guess with many
> > > cores in a NUMA configuration fcntl locks are just a VERY,
> > > VERY bad idea at all if you want to scale.
> > > 
> > > Please tell me that I am wrong :-)
> > 
> > Reading through
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=Documentation/DocBook/kernel-locking.tmpl
> > indicates to me that this could be solved using RCU to protect the
> > global lock list.
> 
> Follow-up question: The process shared robust mutexes, do
> they scale better? Or do we also sit on a central spinlock
> when we really start beating the futex API?
> 
> I can't imagine futex() spins on one central lock, but I
> also could not imagine that fcntl does, so I would like to
> know about bad surprises before we put much effort into
> annihilate fcntl.

The problem you're seeing is definitely specific to fcntl. (And might
not be that hard to fix, I'm not sure.  The biggest annoyance is
probably the deadlock checking, but I doubt anyone depends on that--so
perhaps we could do something like wait till there's been no progress
for several seconds before kicking off the expensive deadlock check.)

--b.


More information about the samba-technical mailing list