aboutsummaryrefslogtreecommitdiff
path: root/include/linux/rcupreempt.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-11 10:29:28 +0100
committerIngo Molnar <mingo@elte.hu>2009-03-11 10:29:28 +0100
commit1d8ce7bc4d05b4a5c04dc17f92fef26989fb5935 (patch)
tree12df0f2e25e95654156b2900bd6df1abb3c2e87a /include/linux/rcupreempt.h
parent3a450de1365d20afde406f0d9b2931a5e4a4fd6a (diff)
parent16b71fdf97599f1b1b7f38418ee9922d9f117396 (diff)
Merge branch 'linus' into core/percpu
Conflicts: arch/x86/include/asm/fixmap_64.h
Diffstat (limited to 'include/linux/rcupreempt.h')
-rw-r--r--include/linux/rcupreempt.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 3e05c09b54a..74304b4538d 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -142,4 +142,19 @@ static inline void rcu_exit_nohz(void)
#define rcu_exit_nohz() do { } while (0)
#endif /* CONFIG_NO_HZ */
+/*
+ * A context switch is a grace period for rcupreempt synchronize_rcu()
+ * only during early boot, before the scheduler has been initialized.
+ * So, how the heck do we get a context switch? Well, if the caller
+ * invokes synchronize_rcu(), they are willing to accept a context
+ * switch, so we simply pretend that one happened.
+ *
+ * After boot, there might be a blocked or preempted task in an RCU
+ * read-side critical section, so we cannot then take the fastpath.
+ */
+static inline int rcu_blocking_is_gp(void)
+{
+ return num_online_cpus() == 1 && !rcu_scheduler_active;
+}
+
#endif /* __LINUX_RCUPREEMPT_H */