diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-01-27 06:29:13 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-01-27 06:29:37 -0500 |
commit | f97b12cce6dea51880a6a89d4607c29c70a6a841 (patch) | |
tree | 1f05f6d39975bd213e7506e8a73ae0a59188c75e /kernel/srcu.c | |
parent | ccaa8d657117bb1876d471bd91579d774106778d (diff) | |
parent | 1bae4ce27c9c90344f23c65ea6966c50ffeae2f5 (diff) |
Merge commit 'v2.6.38-rc2' into core/locking
Reason: Update to mainline before adding the locking cleanup
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/srcu.c')
-rw-r--r-- | kernel/srcu.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/kernel/srcu.c b/kernel/srcu.c index c71e07500536..73ce23feaea9 100644 --- a/kernel/srcu.c +++ b/kernel/srcu.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/rcupdate.h> | 31 | #include <linux/rcupdate.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/smp.h> | 33 | #include <linux/smp.h> |
34 | #include <linux/delay.h> | ||
34 | #include <linux/srcu.h> | 35 | #include <linux/srcu.h> |
35 | 36 | ||
36 | static int init_srcu_struct_fields(struct srcu_struct *sp) | 37 | static int init_srcu_struct_fields(struct srcu_struct *sp) |
@@ -155,6 +156,16 @@ void __srcu_read_unlock(struct srcu_struct *sp, int idx) | |||
155 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); | 156 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); |
156 | 157 | ||
157 | /* | 158 | /* |
159 | * We use an adaptive strategy for synchronize_srcu() and especially for | ||
160 | * synchronize_srcu_expedited(). We spin for a fixed time period | ||
161 | * (defined below) to allow SRCU readers to exit their read-side critical | ||
162 | * sections. If there are still some readers after 10 microseconds, | ||
163 | * we repeatedly block for 1-millisecond time periods. This approach | ||
164 | * has done well in testing, so there is no need for a config parameter. | ||
165 | */ | ||
166 | #define SYNCHRONIZE_SRCU_READER_DELAY 10 | ||
167 | |||
168 | /* | ||
158 | * Helper function for synchronize_srcu() and synchronize_srcu_expedited(). | 169 | * Helper function for synchronize_srcu() and synchronize_srcu_expedited(). |
159 | */ | 170 | */ |
160 | static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void)) | 171 | static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void)) |
@@ -203,9 +214,15 @@ static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void)) | |||
203 | * all srcu_read_lock() calls using the old counters have completed. | 214 | * all srcu_read_lock() calls using the old counters have completed. |
204 | * Their corresponding critical sections might well be still | 215 | * Their corresponding critical sections might well be still |
205 | * executing, but the srcu_read_lock() primitives themselves | 216 | * executing, but the srcu_read_lock() primitives themselves |
206 | * will have finished executing. | 217 | * will have finished executing. We initially give readers |
218 | * an arbitrarily chosen 10 microseconds to get out of their | ||
219 | * SRCU read-side critical sections, then loop waiting 1/HZ | ||
220 | * seconds per iteration. The 10-microsecond value has done | ||
221 | * very well in testing. | ||
207 | */ | 222 | */ |
208 | 223 | ||
224 | if (srcu_readers_active_idx(sp, idx)) | ||
225 | udelay(SYNCHRONIZE_SRCU_READER_DELAY); | ||
209 | while (srcu_readers_active_idx(sp, idx)) | 226 | while (srcu_readers_active_idx(sp, idx)) |
210 | schedule_timeout_interruptible(1); | 227 | schedule_timeout_interruptible(1); |
211 | 228 | ||