cvs commit: src/share/man/man9 locking.9 rmlock.9 src/sys/conf
files src/sys/kern kern_rmlock.c subr_lock.c subr_pcpu.c subr_smp.c
src/sys/sys _rmlock.h lock.h pcpu.h rmlock.h smp.h
rwatson at FreeBSD.org
Mon Nov 26 02:18:53 PST 2007
On Sun, 25 Nov 2007, Alfred Perlstein wrote:
> * Julian Elischer <julian at elischer.org> [071125 10:05] wrote:
>> not sure why sx-locks exist at all, as they seem to be a variant of sleep.
>> I think it's just a convenience function set to allow one to implement a
>> sleep-derived synchronisation.
> You are correct, sx locks are a faster replacement for hand rolled msleep
> locks. They're not only easier to read, but the underlying implementation
> is faster.
We shouldn't under-emphasize the performance point: sx(9) locks instead of a
hand-rolled msleep(9) lock for struct filedesc are one of the most important
performance improvements in 7.0, and responsible for a large part of the MySQL
improvement. A big part of the improvement is avoiding nasty thundering herd
behavior when there's contention. Likewise, moving to sx(9) instead of
hand-rolled msleep(9) locks in the socket buffer code made a noticeable
difference in performance as well, although the thundering herd there was much
less of a problem.
Robert N M Watson
University of Cambridge
More information about the cvs-src