A machine-independent spinlock implementation. It has the advantages of
authorJeffrey Hsu <hsu@dragonflybsd.org>
Sun, 28 Aug 2005 15:27:05 +0000 (15:27 +0000)
committerJeffrey Hsu <hsu@dragonflybsd.org>
Sun, 28 Aug 2005 15:27:05 +0000 (15:27 +0000)
commitb1af91cb61795d655b3630e2a826694cd99e817a
tree276ac98f463fe0cdf229aa9791a8de4079f1582c
parentdce3f9a7102ae32e2e135a0e0213313715387a08
A machine-independent spinlock implementation.  It has the advantages of
  1.  being written in C except for the most low-level atomic swap primitive,
        which is universally supported on current processor architectures
  2.  having a very small inlined memory footprint for spin_lock(),
        with the slow-path defered to a subroutine call
  3.  only requiring a bus-locked operation for lock acquisition,
         and not requiring a bus-locked operation for lock release
  4.  doing a non-bus-locked check first in the spin loop to
        reduce bus contention
  5.  doing exponential backoff in the uncommon contested case, which
        Sun has found to reduce bus contention by a factor of 5 or more

Reviewed by: Matt Dillon
16 files changed:
sys/amd64/include/lock.h
sys/conf/files
sys/cpu/i386/include/atomic.h
sys/cpu/i386/include/cpufunc.h
sys/i386/i386/machdep.c
sys/i386/i386/mp_machdep.c
sys/i386/i386/spinlock.s
sys/i386/include/atomic.h
sys/i386/include/cpufunc.h
sys/i386/include/lock.h
sys/kern/kern_spinlock.c [new file with mode: 0644]
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/mp_machdep.c
sys/platform/pc32/i386/spinlock.s
sys/platform/pc32/include/lock.h
sys/sys/spinlock.h [new file with mode: 0644]