aboutsummaryrefslogtreecommitdiff
path: root/contrib/bind9/lib/dns
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2012-04-05 02:24:08 +0000
committerDavid Xu <davidxu@FreeBSD.org>2012-04-05 02:24:08 +0000
commit17ce60632137c4e6bff703cbedd9d9331a8273c1 (patch)
tree60c1de33c1c2173dd66d3d3bd988eaf58e759fd3 /contrib/bind9/lib/dns
parent6188bf47c83ab1ccc7de35a857b17e247f6ff2fb (diff)
downloadsrc-17ce60632137c4e6bff703cbedd9d9331a8273c1.tar.gz
src-17ce60632137c4e6bff703cbedd9d9331a8273c1.zip
umtx operation UMTX_OP_MUTEX_WAKE has a side-effect that it accesses
a mutex after a thread has unlocked it, it event writes data to the mutex memory to clear contention bit, there is a race that other threads can lock it and unlock it, then destroy it, so it should not write data to the mutex memory if there isn't any waiter. The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It requires thread library to clear the lock word entirely, then call the WAKE2 operation to check if there is any waiter in kernel, and try to wake up a thread, if necessary, the contention bit is set again by the operation. This also mitgates the chance that other threads find the contention bit and try to enter kernel to compete with each other to wake up sleeping thread, this is unnecessary. With this change, the mutex owner is no longer holding the mutex until it reaches a point where kernel umtx queue is locked, it releases the mutex as soon as possible. Performance is improved when the mutex is contensted heavily. On Intel i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c
Notes
Notes: svn path=/head/; revision=233912
Diffstat (limited to 'contrib/bind9/lib/dns')
0 files changed, 0 insertions, 0 deletions