]> git.proxmox.com Git - mirror_spl-debian.git/commit
Optimize spl_rwsem_is_locked()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 13 Jul 2012 19:49:40 +0000 (12:49 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 13 Jul 2012 20:07:39 +0000 (13:07 -0700)
commitd503b971f4848f1b9d654684f1b3c864baad5d88
treec7f7f6d99b6f800f944012161d5620b00953cd8f
parentd801db1487205365b268efab4700e3541adab493
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>
include/linux/rwsem_compat.h