HomeFreeBSD

sched_ule(4): Use trylock when stealing load.

Description

sched_ule(4): Use trylock when stealing load.

On some load patterns it is possible for several CPUs to try steal
thread from the same CPU despite randomization introduced. It may
cause significant lock contention when holding one queue lock idle
thread tries to acquire another one. Use of trylock on the remote
queue allows both reduce the contention and handle lock ordering
easier. If we can't get lock inside tdq_trysteal() we just return,
allowing tdq_idled() handle it. If it happens in tdq_idled(), then
we repeat search for load skipping this CPU.

On 2-socket 80-thread Xeon system I am observing dramatic reduction
of the lock spinning time when doing random uncached 4KB reads from
12 ZVOLs, while IOPS increase from 327K to 403K.

MFC after: 1 month

(cherry picked from commit 8bb173fb5bc33a02d5a4670c9a60bba0ece07bac)

Details

Provenance
mavAuthored on Aug 2 2021, 2:42 AM
Parents
rG18bc112f63b6: sched_ule(4): Reduce duplicate search for load.
Branches
Unknown
Tags
Unknown