locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / rcupdate.c
index 2bc4e13..a86f174 100644 (file)
@@ -88,6 +88,9 @@ EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled);
  * section.
  *
  * Check debug_lockdep_rcu_enabled() to prevent false positives during boot.
+ *
+ * Note that rcu_read_lock() is disallowed if the CPU is either idle or
+ * offline from an RCU perspective, so check for those as well.
  */
 int rcu_read_lock_bh_held(void)
 {
@@ -95,6 +98,8 @@ int rcu_read_lock_bh_held(void)
                return 1;
        if (rcu_is_cpu_idle())
                return 0;
+       if (!rcu_lockdep_current_cpu_online())
+               return 0;
        return in_softirq() || irqs_disabled();
 }
 EXPORT_SYMBOL_GPL(rcu_read_lock_bh_held);