Acquiring a lock on the same CPU that holds it - what can be done?

Konstantin Belousov kostikbel at gmail.com
Wed Jan 8 18:59:18 UTC 2014


On Wed, Jan 08, 2014 at 06:29:59PM +0200, Andriy Gapon wrote:
> 
> I am sure that the following approach was suggested before, but I can not find
> any references now.
> So, the idea is to auto-associate a priority with a lock.  Every time a priority
> lending would kick in we would record the priority in the lock.  The next time a
> thread with a lower priority acquires that lock we would automatically boost the
> thread to the recorded priority until it releases the lock.  This should prevent
> the situation that you've described where a higher priority thread preempts a
> lower priority thread just to discover that it holds a required lock and
> priority lending is required before relinquishing a CPU to the preempted thread.

Isn't this exactly the mechanism offered by turnstiles, and used by
non-sleepable locks ?

> 
> I am sure that there could be downsides to this approach.
> -- 
> Andriy Gapon
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140108/814977e9/attachment.sig>


More information about the freebsd-arch mailing list