aboutsummaryrefslogtreecommitdiff
path: root/include/linux/rcupreempt.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-12 13:16:18 +0100
committerIngo Molnar <mingo@elte.hu>2009-03-12 13:16:18 +0100
commitf8cb22cbb8383c9f41e6ccbcd4fb94edb1048bda (patch)
tree9b3a333224ec895c053a694dcaff526502b84e6c /include/linux/rcupreempt.h
parent044d408409cc4e1bc75c886e27ca85c270db104c (diff)
parentebdcc81c71937b30e09110c02a1e8a21fa770b6f (diff)
Merge branch 'linus' into irq/genirq
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 */