HomeFreeBSD

MFC r303562,303563,r303584,r303643,r303652,r303655,r303707:

Description

MFC r303562,303563,r303584,r303643,r303652,r303655,r303707:

rwlock: s/READER/WRITER/ in wlock lockstat annotation

sx: increment spin_cnt before cpu_spinwait in xlock

The change is a no-op only done for consistency with the rest of the file.

locks: change sleep_cnt and spin_cnt types to u_int

Both variables are uint64_t, but they only count spins or sleeps.
All reasonable values which we can get here comfortably hit in 32-bit range.

Implement trivial backoff for locking primitives.

All current spinning loops retry an atomic op the first chance they get,
which leads to performance degradation under load.

One classic solution to the problem consists of delaying the test to an
extent. This implementation has a trivial linear increment and a random
factor for each attempt.

For simplicity, this first thouch implementation only modifies spinning
loops where the lock owner is running. spin mutexes and thread lock were
not modified.

Current parameters are autotuned on boot based on mp_cpus.

Autotune factors are very conservative and are subject to change later.

locks: fix up ifdef guards introduced in r303643

Both sx and rwlocks had copy-pasted ADAPTIVE_MUTEXES instead of the correct
define.

locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case

locks: fix sx compilation on mips after r303643

The kernel.h header is required for the SYSINIT macro, which apparently
was present on amd64 by accident.

Approved by: re (gjb)

Details

Provenance
mjgAuthored on
Parents
rS303952: MFH (r303832): check whether each key file exists before adding it
Branches
Unknown
Tags
Unknown