diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-01-07 05:33:47 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-01-14 07:56:49 -0500 |
commit | c072a388d59a1d48e36864d0e66f42d71745be1c (patch) | |
tree | a0537c767c834d1846430ab3bb4eb83c0d0923d7 | |
parent | 394f4528c523d88daabd50f883a8d6b164075555 (diff) |
rcu: demote SRCU_SYNCHRONIZE_DELAY from kernel-parameter status
Because the adaptive synchronize_srcu_expedited() approach has
worked very well in testing, remove the kernel parameter and
replace it by a C-preprocessor macro. If someone finds problems
with this approach, a more complex and aggressively adaptive
approach might be required.
Longer term, SRCU will be merged with the other RCU implementations,
at which point synchronize_srcu_expedited() will be event driven,
just as synchronize_sched_expedited() currently is. At that point,
there will be no need for this adaptive approach.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | init/Kconfig | 15 | ||||
-rw-r--r-- | kernel/srcu.c | 15 |
2 files changed, 13 insertions, 17 deletions
diff --git a/init/Kconfig b/init/Kconfig index 526ec1c7456a..e11bc793a91d 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -497,21 +497,6 @@ config RCU_BOOST_DELAY | |||
497 | 497 | ||
498 | Accept the default if unsure. | 498 | Accept the default if unsure. |
499 | 499 | ||
500 | config SRCU_SYNCHRONIZE_DELAY | ||
501 | int "Microseconds to delay before waiting for readers" | ||
502 | range 0 20 | ||
503 | default 10 | ||
504 | help | ||
505 | This option controls how long SRCU delays before entering its | ||
506 | loop waiting on SRCU readers. The purpose of this loop is | ||
507 | to avoid the unconditional context-switch penalty that would | ||
508 | otherwise be incurred if there was an active SRCU reader, | ||
509 | in a manner similar to adaptive locking schemes. This should | ||
510 | be set to be a bit longer than the common-case SRCU read-side | ||
511 | critical-section overhead. | ||
512 | |||
513 | Accept the default if unsure. | ||
514 | |||
515 | endmenu # "RCU Subsystem" | 500 | endmenu # "RCU Subsystem" |
516 | 501 | ||
517 | config IKCONFIG | 502 | config IKCONFIG |
diff --git a/kernel/srcu.c b/kernel/srcu.c index 98d8c1e80edb..73ce23feaea9 100644 --- a/kernel/srcu.c +++ b/kernel/srcu.c | |||
@@ -156,6 +156,16 @@ void __srcu_read_unlock(struct srcu_struct *sp, int idx) | |||
156 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); | 156 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); |
157 | 157 | ||
158 | /* | 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 | /* | ||
159 | * Helper function for synchronize_srcu() and synchronize_srcu_expedited(). | 169 | * Helper function for synchronize_srcu() and synchronize_srcu_expedited(). |
160 | */ | 170 | */ |
161 | 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)) |
@@ -207,11 +217,12 @@ static void __synchronize_srcu(struct srcu_struct *sp, void (*sync_func)(void)) | |||
207 | * will have finished executing. We initially give readers | 217 | * will have finished executing. We initially give readers |
208 | * an arbitrarily chosen 10 microseconds to get out of their | 218 | * an arbitrarily chosen 10 microseconds to get out of their |
209 | * SRCU read-side critical sections, then loop waiting 1/HZ | 219 | * SRCU read-side critical sections, then loop waiting 1/HZ |
210 | * seconds per iteration. | 220 | * seconds per iteration. The 10-microsecond value has done |
221 | * very well in testing. | ||
211 | */ | 222 | */ |
212 | 223 | ||
213 | if (srcu_readers_active_idx(sp, idx)) | 224 | if (srcu_readers_active_idx(sp, idx)) |
214 | udelay(CONFIG_SRCU_SYNCHRONIZE_DELAY); | 225 | udelay(SYNCHRONIZE_SRCU_READER_DELAY); |
215 | while (srcu_readers_active_idx(sp, idx)) | 226 | while (srcu_readers_active_idx(sp, idx)) |
216 | schedule_timeout_interruptible(1); | 227 | schedule_timeout_interruptible(1); |
217 | 228 | ||