rcu: Remove redundant debug_locks check in rcu_read_lock_sched_held()
authorJoel Fernandes (Google) <joel@joelfernandes.org>
Tue, 16 Jul 2019 22:12:21 +0000 (18:12 -0400)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Thu, 1 Aug 2019 21:17:01 +0000 (14:17 -0700)
The debug_locks flag can never be true at the end of
rcu_read_lock_sched_held() because it is already checked by the earlier
call todebug_lockdep_rcu_enabled().   This commit therefore removes this
redundant check.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
kernel/rcu/update.c

index 61df2bf08563201e54b0ad667be1cab049c50aea..9dd5aeef6e709c2f079e82340d73dd48a0e3a019 100644 (file)
@@ -93,17 +93,13 @@ module_param(rcu_normal_after_boot, int, 0);
  */
 int rcu_read_lock_sched_held(void)
 {
-       int lockdep_opinion = 0;
-
        if (!debug_lockdep_rcu_enabled())
                return 1;
        if (!rcu_is_watching())
                return 0;
        if (!rcu_lockdep_current_cpu_online())
                return 0;
-       if (debug_locks)
-               lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
-       return lockdep_opinion || !preemptible();
+       return lock_is_held(&rcu_sched_lock_map) || !preemptible();
 }
 EXPORT_SYMBOL(rcu_read_lock_sched_held);
 #endif