diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-05-27 01:14:36 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:36:42 -0400 |
commit | 2c42818e962e2858334bf45bfc56662b3752df34 (patch) | |
tree | 192364123c9aeeab282c53168e51eddece9d8be4 /kernel/rcupdate.c | |
parent | f039d1f1884b2fe9c13d28f59d8330f0b0518fc4 (diff) |
rcu: Abstract common code for RCU grace-period-wait primitives
Pull the code that waits for an RCU grace period into a single function,
which is then called by synchronize_rcu() and friends in the case of
TREE_RCU and TREE_PREEMPT_RCU, and from rcu_barrier() and friends in
the case of TINY_RCU and TINY_PREEMPT_RCU.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcupdate.c')
-rw-r--r-- | kernel/rcupdate.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index ddddb320be61..09b3b1b54e02 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -94,11 +94,16 @@ EXPORT_SYMBOL_GPL(rcu_read_lock_bh_held); | |||
94 | 94 | ||
95 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 95 | #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
96 | 96 | ||
97 | struct rcu_synchronize { | ||
98 | struct rcu_head head; | ||
99 | struct completion completion; | ||
100 | }; | ||
101 | |||
97 | /* | 102 | /* |
98 | * Awaken the corresponding synchronize_rcu() instance now that a | 103 | * Awaken the corresponding synchronize_rcu() instance now that a |
99 | * grace period has elapsed. | 104 | * grace period has elapsed. |
100 | */ | 105 | */ |
101 | void wakeme_after_rcu(struct rcu_head *head) | 106 | static void wakeme_after_rcu(struct rcu_head *head) |
102 | { | 107 | { |
103 | struct rcu_synchronize *rcu; | 108 | struct rcu_synchronize *rcu; |
104 | 109 | ||
@@ -106,6 +111,20 @@ void wakeme_after_rcu(struct rcu_head *head) | |||
106 | complete(&rcu->completion); | 111 | complete(&rcu->completion); |
107 | } | 112 | } |
108 | 113 | ||
114 | void wait_rcu_gp(call_rcu_func_t crf) | ||
115 | { | ||
116 | struct rcu_synchronize rcu; | ||
117 | |||
118 | init_rcu_head_on_stack(&rcu.head); | ||
119 | init_completion(&rcu.completion); | ||
120 | /* Will wake me after RCU finished. */ | ||
121 | crf(&rcu.head, wakeme_after_rcu); | ||
122 | /* Wait for it. */ | ||
123 | wait_for_completion(&rcu.completion); | ||
124 | destroy_rcu_head_on_stack(&rcu.head); | ||
125 | } | ||
126 | EXPORT_SYMBOL_GPL(wait_rcu_gp); | ||
127 | |||
109 | #ifdef CONFIG_PROVE_RCU | 128 | #ifdef CONFIG_PROVE_RCU |
110 | /* | 129 | /* |
111 | * wrapper function to avoid #include problems. | 130 | * wrapper function to avoid #include problems. |