Acquiring a lock on the same CPU that holds it - what can be done?
Andriy Gapon
avg at FreeBSD.org
Wed Jan 8 16:31:29 UTC 2014
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.
I am sure that there could be downsides to this approach.
--
Andriy Gapon
More information about the freebsd-arch
mailing list