cvs commit: src/sys/kern kern_rwlock.c
John Baldwin
jhb at FreeBSD.org
Tue Apr 18 18:27:55 UTC 2006
jhb 2006-04-18 18:27:54 UTC
FreeBSD src repository
Modified files:
sys/kern kern_rwlock.c
Log:
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.
Revision Changes Path
1.7 +88 -7 src/sys/kern/kern_rwlock.c
More information about the cvs-src
mailing list