diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-21 12:06:52 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-21 12:06:52 -0400 |
| commit | b8c7f1dc5ca4e0d10709182233cdab932cef593d (patch) | |
| tree | 28c5f79d61ce7167511f18eaed5c9fca87c68ab4 /kernel | |
| parent | f4eccb6d979e0cc5a719a50af5f9a56e79092a2d (diff) | |
| parent | a71fca58b7f4abca551ae2256ac08dd9123a03f9 (diff) | |
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
rcu: Fix whitespace inconsistencies
rcu: Fix thinko, actually initialize full tree
rcu: Apply results of code inspection of kernel/rcutree_plugin.h
rcu: Add WARN_ON_ONCE() consistency checks covering state transitions
rcu: Fix synchronize_rcu() for TREE_PREEMPT_RCU
rcu: Simplify rcu_read_unlock_special() quiescent-state accounting
rcu: Add debug checks to TREE_PREEMPT_RCU for premature grace periods
rcu: Kconfig help needs to say that TREE_PREEMPT_RCU scales down
rcutorture: Occasionally delay readers enough to make RCU force_quiescent_state
rcu: Initialize multi-level RCU grace periods holding locks
rcu: Need to update rnp->gpnum if preemptable RCU is to be reliable
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcupdate.c | 48 | ||||
| -rw-r--r-- | kernel/rcutorture.c | 43 | ||||
| -rw-r--r-- | kernel/rcutree.c | 105 | ||||
| -rw-r--r-- | kernel/rcutree.h | 2 | ||||
| -rw-r--r-- | kernel/rcutree_plugin.h | 110 | ||||
| -rw-r--r-- | kernel/rcutree_trace.c | 2 |
6 files changed, 181 insertions, 129 deletions
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index bd5d5c8e514..37ac4548308 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | * | 19 | * |
| 20 | * Authors: Dipankar Sarma <dipankar@in.ibm.com> | 20 | * Authors: Dipankar Sarma <dipankar@in.ibm.com> |
| 21 | * Manfred Spraul <manfred@colorfullife.com> | 21 | * Manfred Spraul <manfred@colorfullife.com> |
| 22 | * | 22 | * |
| 23 | * Based on the original work by Paul McKenney <paulmck@us.ibm.com> | 23 | * Based on the original work by Paul McKenney <paulmck@us.ibm.com> |
| 24 | * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. | 24 | * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. |
| 25 | * Papers: | 25 | * Papers: |
| @@ -27,7 +27,7 @@ | |||
| 27 | * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) | 27 | * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) |
| 28 | * | 28 | * |
| 29 | * For detailed explanation of Read-Copy Update mechanism see - | 29 | * For detailed explanation of Read-Copy Update mechanism see - |
| 30 | * http://lse.sourceforge.net/locking/rcupdate.html | 30 | * http://lse.sourceforge.net/locking/rcupdate.html |
| 31 | * | 31 | * |
| 32 | */ | 32 | */ |
| 33 | #include <linux/types.h> | 33 | #include <linux/types.h> |
| @@ -74,6 +74,8 @@ void wakeme_after_rcu(struct rcu_head *head) | |||
| 74 | complete(&rcu->completion); | 74 | complete(&rcu->completion); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
| 78 | |||
| 77 | /** | 79 | /** |
| 78 | * synchronize_rcu - wait until a grace period has elapsed. | 80 | * synchronize_rcu - wait until a grace period has elapsed. |
| 79 | * | 81 | * |
| @@ -87,7 +89,7 @@ void synchronize_rcu(void) | |||
| 87 | { | 89 | { |
| 88 | struct rcu_synchronize rcu; | 90 | struct rcu_synchronize rcu; |
| 89 | 91 | ||
| 90 | if (rcu_blocking_is_gp()) | 92 | if (!rcu_scheduler_active) |
| 91 | return; | 93 | return; |
| 92 | 94 | ||
| 93 | init_completion(&rcu.completion); | 95 | init_completion(&rcu.completion); |
| @@ -98,6 +100,46 @@ void synchronize_rcu(void) | |||
| 98 | } | 100 | } |
| 99 | EXPORT_SYMBOL_GPL(synchronize_rcu); | 101 | EXPORT_SYMBOL_GPL(synchronize_rcu); |
| 100 | 102 | ||
| 103 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
| 104 | |||
| 105 | /** | ||
| 106 | * synchronize_sched - wait until an rcu-sched grace period has elapsed. | ||
| 107 | * | ||
| 108 | * Control will return to the caller some time after a full rcu-sched | ||
| 109 | * grace period has elapsed, in other words after all currently executing | ||
| 110 | * rcu-sched read-side critical sections have completed. These read-side | ||
| 111 | * critical sections are delimited by rcu_read_lock_sched() and | ||
| 112 | * rcu_read_unlock_sched(), and may be nested. Note that preempt_disable(), | ||
| 113 | * local_irq_disable(), and so on may be used in place of | ||
| 114 | * rcu_read_lock_sched(). | ||
| 115 | * | ||
| 116 | * This means that all preempt_disable code sequences, including NMI and | ||
| 117 | * hardware-interrupt handlers, in progress on entry will have completed | ||
| 118 | * before this primitive returns. However, this does not guarantee that | ||
| 119 | * softirq handlers will have completed, since in some kernels, these | ||
| 120 | * handlers can run in process context, and can block. | ||
| 121 | * | ||
| 122 | * This primitive provides the guarantees made by the (now removed) | ||
| 123 | * synchronize_kernel() API. In contrast, synchronize_rcu() only | ||
| 124 | * guarantees that rcu_read_lock() sections will have completed. | ||
| 125 | * In "classic RCU", these two guarantees happen to be one and | ||
| 126 | * the same, but can differ in realtime RCU implementations. | ||
| 127 | */ | ||
| 128 | void synchronize_sched(void) | ||
| 129 | { | ||
| 130 | struct rcu_synchronize rcu; | ||
| 131 | |||
| 132 | if (rcu_blocking_is_gp()) | ||
| 133 | return; | ||
| 134 | |||
| 135 | init_completion(&rcu.completion); | ||
| 136 | /* Will wake me after RCU finished. */ | ||
| 137 | call_rcu_sched(&rcu.head, wakeme_after_rcu); | ||
| 138 | /* Wait for it. */ | ||
| 139 | wait_for_completion(&rcu.completion); | ||
| 140 | } | ||
| 141 | EXPORT_SYMBOL_GPL(synchronize_sched); | ||
| 142 | |||
| 101 | /** | 143 | /** |
| 102 | * synchronize_rcu_bh - wait until an rcu_bh grace period has elapsed. | 144 | * synchronize_rcu_bh - wait until an rcu_bh grace period has elapsed. |
| 103 | * | 145 | * |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index b33db539a8a..233768f21f9 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | * Copyright (C) IBM Corporation, 2005, 2006 | 18 | * Copyright (C) IBM Corporation, 2005, 2006 |
| 19 | * | 19 | * |
| 20 | * Authors: Paul E. McKenney <paulmck@us.ibm.com> | 20 | * Authors: Paul E. McKenney <paulmck@us.ibm.com> |
| 21 | * Josh Triplett <josh@freedesktop.org> | 21 | * Josh Triplett <josh@freedesktop.org> |
| 22 | * | 22 | * |
| 23 | * See also: Documentation/RCU/torture.txt | 23 | * See also: Documentation/RCU/torture.txt |
| 24 | */ | 24 | */ |
| @@ -50,7 +50,7 @@ | |||
| 50 | 50 | ||
| 51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
| 52 | MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and " | 52 | MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com> and " |
| 53 | "Josh Triplett <josh@freedesktop.org>"); | 53 | "Josh Triplett <josh@freedesktop.org>"); |
| 54 | 54 | ||
| 55 | static int nreaders = -1; /* # reader threads, defaults to 2*ncpus */ | 55 | static int nreaders = -1; /* # reader threads, defaults to 2*ncpus */ |
| 56 | static int nfakewriters = 4; /* # fake writer threads */ | 56 | static int nfakewriters = 4; /* # fake writer threads */ |
| @@ -110,8 +110,8 @@ struct rcu_torture { | |||
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | static LIST_HEAD(rcu_torture_freelist); | 112 | static LIST_HEAD(rcu_torture_freelist); |
| 113 | static struct rcu_torture *rcu_torture_current = NULL; | 113 | static struct rcu_torture *rcu_torture_current; |
| 114 | static long rcu_torture_current_version = 0; | 114 | static long rcu_torture_current_version; |
| 115 | static struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN]; | 115 | static struct rcu_torture rcu_tortures[10 * RCU_TORTURE_PIPE_LEN]; |
| 116 | static DEFINE_SPINLOCK(rcu_torture_lock); | 116 | static DEFINE_SPINLOCK(rcu_torture_lock); |
| 117 | static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_count) = | 117 | static DEFINE_PER_CPU(long [RCU_TORTURE_PIPE_LEN + 1], rcu_torture_count) = |
| @@ -124,11 +124,11 @@ static atomic_t n_rcu_torture_alloc_fail; | |||
| 124 | static atomic_t n_rcu_torture_free; | 124 | static atomic_t n_rcu_torture_free; |
| 125 | static atomic_t n_rcu_torture_mberror; | 125 | static atomic_t n_rcu_torture_mberror; |
| 126 | static atomic_t n_rcu_torture_error; | 126 | static atomic_t n_rcu_torture_error; |
| 127 | static long n_rcu_torture_timers = 0; | 127 | static long n_rcu_torture_timers; |
| 128 | static struct list_head rcu_torture_removed; | 128 | static struct list_head rcu_torture_removed; |
| 129 | static cpumask_var_t shuffle_tmp_mask; | 129 | static cpumask_var_t shuffle_tmp_mask; |
| 130 | 130 | ||
| 131 | static int stutter_pause_test = 0; | 131 | static int stutter_pause_test; |
| 132 | 132 | ||
| 133 | #if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE) | 133 | #if defined(MODULE) || defined(CONFIG_RCU_TORTURE_TEST_RUNNABLE) |
| 134 | #define RCUTORTURE_RUNNABLE_INIT 1 | 134 | #define RCUTORTURE_RUNNABLE_INIT 1 |
| @@ -267,7 +267,8 @@ struct rcu_torture_ops { | |||
| 267 | int irq_capable; | 267 | int irq_capable; |
| 268 | char *name; | 268 | char *name; |
| 269 | }; | 269 | }; |
| 270 | static struct rcu_torture_ops *cur_ops = NULL; | 270 | |
| 271 | static struct rcu_torture_ops *cur_ops; | ||
| 271 | 272 | ||
| 272 | /* | 273 | /* |
| 273 | * Definitions for rcu torture testing. | 274 | * Definitions for rcu torture testing. |
| @@ -281,14 +282,17 @@ static int rcu_torture_read_lock(void) __acquires(RCU) | |||
| 281 | 282 | ||
| 282 | static void rcu_read_delay(struct rcu_random_state *rrsp) | 283 | static void rcu_read_delay(struct rcu_random_state *rrsp) |
| 283 | { | 284 | { |
| 284 | long delay; | 285 | const unsigned long shortdelay_us = 200; |
| 285 | const long longdelay = 200; | 286 | const unsigned long longdelay_ms = 50; |
| 286 | 287 | ||
| 287 | /* We want there to be long-running readers, but not all the time. */ | 288 | /* We want a short delay sometimes to make a reader delay the grace |
| 289 | * period, and we want a long delay occasionally to trigger | ||
| 290 | * force_quiescent_state. */ | ||
| 288 | 291 | ||
| 289 | delay = rcu_random(rrsp) % (nrealreaders * 2 * longdelay); | 292 | if (!(rcu_random(rrsp) % (nrealreaders * 2000 * longdelay_ms))) |
| 290 | if (!delay) | 293 | mdelay(longdelay_ms); |
| 291 | udelay(longdelay); | 294 | if (!(rcu_random(rrsp) % (nrealreaders * 2 * shortdelay_us))) |
| 295 | udelay(shortdelay_us); | ||
| 292 | } | 296 | } |
| 293 | 297 | ||
| 294 | static void rcu_torture_read_unlock(int idx) __releases(RCU) | 298 | static void rcu_torture_read_unlock(int idx) __releases(RCU) |
| @@ -339,8 +343,8 @@ static struct rcu_torture_ops rcu_ops = { | |||
| 339 | .sync = synchronize_rcu, | 343 | .sync = synchronize_rcu, |
| 340 | .cb_barrier = rcu_barrier, | 344 | .cb_barrier = rcu_barrier, |
| 341 | .stats = NULL, | 345 | .stats = NULL, |
| 342 | .irq_capable = 1, | 346 | .irq_capable = 1, |
| 343 | .name = "rcu" | 347 | .name = "rcu" |
| 344 | }; | 348 | }; |
| 345 | 349 | ||
| 346 | static void rcu_sync_torture_deferred_free(struct rcu_torture *p) | ||
