aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcupdate.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/rcupdate.c')
-rw-r--r--kernel/rcupdate.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 9b7fd4723878..63fe25433980 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -44,14 +44,66 @@
44#include <linux/cpu.h> 44#include <linux/cpu.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/kernel_stat.h>
48#include <linux/hardirq.h>
47 49
48#ifdef CONFIG_DEBUG_LOCK_ALLOC 50#ifdef CONFIG_DEBUG_LOCK_ALLOC
49static struct lock_class_key rcu_lock_key; 51static struct lock_class_key rcu_lock_key;
50struct lockdep_map rcu_lock_map = 52struct lockdep_map rcu_lock_map =
51 STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key); 53 STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key);
52EXPORT_SYMBOL_GPL(rcu_lock_map); 54EXPORT_SYMBOL_GPL(rcu_lock_map);
55
56static struct lock_class_key rcu_bh_lock_key;
57struct lockdep_map rcu_bh_lock_map =
58 STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_bh", &rcu_bh_lock_key);
59EXPORT_SYMBOL_GPL(rcu_bh_lock_map);
60
61static struct lock_class_key rcu_sched_lock_key;
62struct lockdep_map rcu_sched_lock_map =
63 STATIC_LOCKDEP_MAP_INIT("rcu_read_lock_sched", &rcu_sched_lock_key);
64EXPORT_SYMBOL_GPL(rcu_sched_lock_map);
53#endif 65#endif
54 66
67int rcu_scheduler_active __read_mostly;
68EXPORT_SYMBOL_GPL(rcu_scheduler_active);
69
70#ifdef CONFIG_DEBUG_LOCK_ALLOC
71
72/**
73 * rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section?
74 *
75 * Check for bottom half being disabled, which covers both the
76 * CONFIG_PROVE_RCU and not cases. Note that if someone uses
77 * rcu_read_lock_bh(), but then later enables BH, lockdep (if enabled)
78 * will show the situation.
79 *
80 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot.
81 */
82int rcu_read_lock_bh_held(void)
83{
84 if (!debug_lockdep_rcu_enabled())
85 return 1;
86 return in_softirq();
87}
88EXPORT_SYMBOL_GPL(rcu_read_lock_bh_held);
89
90#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
91
92/*
93 * This function is invoked towards the end of the scheduler's initialization
94 * process. Before this is called, the idle task might contain
95 * RCU read-side critical sections (during which time, this idle
96 * task is booting the system). After this function is called, the
97 * idle tasks are prohibited from containing RCU read-side critical
98 * sections.
99 */
100void rcu_scheduler_starting(void)
101{
102 WARN_ON(num_online_cpus() != 1);
103 WARN_ON(nr_context_switches() > 0);
104 rcu_scheduler_active = 1;
105}
106
55/* 107/*
56 * Awaken the corresponding synchronize_rcu() instance now that a 108 * Awaken the corresponding synchronize_rcu() instance now that a
57 * grace period has elapsed. 109 * grace period has elapsed.