]> Pileus Git - ~andy/linux/commitdiff
rcu: Improve synchronize_rcu() diagnostics
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 4 Jan 2012 19:44:57 +0000 (11:44 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 21 Feb 2012 17:03:22 +0000 (09:03 -0800)
Although TREE_PREEMPT_RCU indirectly uses might_sleep() to detect illegal
use of synchronize_sched() and synchronize_rcu_bh() from within an RCU
read-side critical section, this might_sleep() check is bypassed when
there is only a single CPU (for example, when running an SMP kernel on
a single-CPU system).  This patch therefore adds a might_sleep() call
to the rcu_blocking_is_gp() check that is unconditionally invoked from
both synchronize_sched() and synchronize_rcu_bh().

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rcutree.h

index 67458468f1a8508becb63997f20271de14df458e..73e7195f999713e5f7aa112cd08779fd38a48689 100644 (file)
@@ -83,6 +83,7 @@ extern void rcu_sched_force_quiescent_state(void);
 /* A context switch is a grace period for RCU-sched and RCU-bh. */
 static inline int rcu_blocking_is_gp(void)
 {
+       might_sleep();  /* Check for RCU read-side critical section. */
        return num_online_cpus() == 1;
 }