[PATCH net-next 5/7] srcu: use a more appropriate lockdep helper

From: Jakub Kicinski
Date: Wed Sep 16 2020 - 14:46:38 EST


lockdep_is_held() is defined as:

#define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)

it hides away the dereference, so that builds with !LOCKDEP
don't break. We should use it instead of using lock_is_held()
directly.

This didn't use to be a problem, because RCU_LOCKDEP_WARN()
cuts the condition out with the preprocessor if !LOCKDEP.
This will soon change.

Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
--
CC: jiangshanlai@xxxxxxxxx
CC: paulmck@xxxxxxxxxx
CC: josh@xxxxxxxxxxxxxxxx
CC: rostedt@xxxxxxxxxxx
CC: mathieu.desnoyers@xxxxxxxxxxxx
---
kernel/rcu/srcutree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index c100acf332ed..8123ef15a159 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -919,7 +919,7 @@ static void __synchronize_srcu(struct srcu_struct *ssp, bool do_norm)
{
struct rcu_synchronize rcu;

- RCU_LOCKDEP_WARN(lock_is_held(&ssp->dep_map) ||
+ RCU_LOCKDEP_WARN(lockdep_is_held(ssp) ||
lock_is_held(&rcu_bh_lock_map) ||
lock_is_held(&rcu_lock_map) ||
lock_is_held(&rcu_sched_lock_map),
--
2.26.2