]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Adaptively spin before blocking on the turnstile if an rwlock is write
authorjhb <jhb@FreeBSD.org>
Tue, 18 Apr 2006 18:27:54 +0000 (18:27 +0000)
committerjhb <jhb@FreeBSD.org>
Tue, 18 Apr 2006 18:27:54 +0000 (18:27 +0000)
commit6a2cfc7f2cfe8bf465f6eff118a5012bf974b473
tree8fdc94f0fbe68a53a8446e54f5d9b3e79b5c1a28
parentd5b6b7dc6f56952194684615c2817ef9771fafa7
Adaptively spin before blocking on the turnstile if an rwlock is write
locked.  In general the adaptive spinning is similar to the same code
for mutexes with some extra trickiness in rw_wunlock_hard().  Specifically,
even though both wait bits might be set and we might have a turnstile with
at least one waiting thread, there might not be any threads blocked on the
queue we are not waking up (they might all be spinning), and we should
only preserve the waiting flag for the queue we aren't waking up if there
are in fact threads blocked on that queue.  Secondly, there might not be
any threads blocked on the queue we have chosen to waken threads from
(there might only be threads blocked on the other queue and the threads
for this queue are all spinning) in which case we disown the turnstile
instead of doing a braodcast and unpend.
sys/kern/kern_rwlock.c