HomeFreeBSD

Optimize spl_rwsem_is_locked()

Description

Optimize spl_rwsem_is_locked()

The spl_rwsem_is_locked() compatibility function has been observed
to be a hot spot. The root cause of this is that we must check the
rwsem activity under the rwsem->wait_lock to avoid a race. When
the lock is busy significant contention can occur.

The upstream kernel fix for this race had the insight that by using
spin_trylock_irqsave() this contention could be avoided. When the
lock is contended it's reasonable to return that it is locked.

This change updates the SPLs implemention to be like the upstream
kernel. Since the kernel code has been in use for years now this
a low risk change.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Jul 13 2012, 7:49 PM
Parents
rGd801db148720: Move spl.release generation to configure step
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGd503b971f484: Optimize spl_rwsem_is_locked() (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Jul 13 2012, 8:07 PM