Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Jan 2014 18:29:59 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Adrian Chadd <adrian@FreeBSD.org>, "freebsd-arch@freebsd.org" <freebsd-arch@FreeBSD.org>
Subject:   Re: Acquiring a lock on the same CPU that holds it - what can be done?
Message-ID:  <52CD7D07.2010608@FreeBSD.org>
In-Reply-To: <CAJ-Vmok-AJkz0THu72ThTdRhO2h1CnHwffq=cFZGZkbC=cWJZA@mail.gmail.com>
References:  <CAJ-Vmok-AJkz0THu72ThTdRhO2h1CnHwffq=cFZGZkbC=cWJZA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52CD7D07.2010608>