srcu: Allow early boot use of synchronize_srcu()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 10 Feb 2017 22:50:46 +0000 (14:50 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 18 Apr 2017 18:38:18 +0000 (11:38 -0700)
This commit checks for pre-scheduler state, and if that early in the
boot process, synchronize_srcu() and friends are no-ops.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/srcu.c

index e6da9fc1f0e976b274dc26c230537a649b2c8fa6..7e7ecaa50dc5ec2a037fb5c674b8ad9f1cd9317b 100644 (file)
@@ -417,6 +417,8 @@ static void __synchronize_srcu(struct srcu_struct *sp, int trycount)
                         lock_is_held(&rcu_sched_lock_map),
                         "Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section");
 
+       if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
+               return;
        might_sleep();
        init_completion(&rcu.completion);