Whamcloud - gitweb
LU-4801 ldlm: discard l_lock from struct ldlm_lock.
This spinlock (l_lock) is only used to stablise the l_resource
pointer while taking a spinlock on the resource.
This is not necessary - it is sufficient to take the resource
spinlock, and then check if l_resource has changed or not. If it
hasn't then it cannot change until the resource spinlock is dropped.
We must ensure this is safe even if the resource is freed before
lock_res_and_lock() managed to get the lock. To do this we mark the
slab as SLAB_TYPESAFE_BY_RCU and initialise the lock in an
init_once() function, but not on every allocate (and specifically
don't zero the whole struct on each allocation).
This means that if we find a resource after taking the RCU read lock,
then it is always safe to take and then drop the spinlock.
After taking the spinlock, we can check if it is more generally safe
to use.
Discarding l_lock shrinks 'struct ldlm_lock' which helps save memory.
Change-Id: I2646f198ca60bdbd2e94922bf7679fab31f45c41
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/35483
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>