]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
2 | Subject: RCU read sched | |
3 | ||
4 | Add rcu_read_lock_sched() and rcu_read_unlock_sched() to rcupdate.h to match the | |
5 | recently added write-side call_rcu_sched() and rcu_barrier_sched(). They also | |
6 | match the no-so-recently-added synchronize_sched(). | |
7 | ||
8 | It will help following matching use of the update/read lock primitives. Those | |
9 | new read lock will replace preempt_disable()/enable() used in pair with | |
10 | RCU-classic synchronization. | |
11 | ||
12 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | |
13 | Acked-by: Peter Zijlstra <peterz@infradead.org> | |
14 | CC: Paul E McKenney <paulmck@linux.vnet.ibm.com> | |
15 | CC: akpm@linux-foundation.org | |
16 | Acked-by: Jan Blunck <jblunck@suse.de> | |
17 | --- | |
18 | include/linux/rcupdate.h | 20 ++++++++++++++++++++ | |
19 | 1 file changed, 20 insertions(+) | |
20 | ||
21 | --- a/include/linux/rcupdate.h | |
22 | +++ b/include/linux/rcupdate.h | |
23 | @@ -133,6 +133,26 @@ struct rcu_head { | |
24 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | |
25 | ||
26 | /** | |
27 | + * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section | |
28 | + * | |
29 | + * Should be used with either | |
30 | + * - synchronize_sched() | |
31 | + * or | |
32 | + * - call_rcu_sched() and rcu_barrier_sched() | |
33 | + * on the write-side to insure proper synchronization. | |
34 | + */ | |
35 | +#define rcu_read_lock_sched() preempt_disable() | |
36 | + | |
37 | +/* | |
38 | + * rcu_read_unlock_sched - marks the end of a RCU-classic critical section | |
39 | + * | |
40 | + * See rcu_read_lock_sched for more information. | |
41 | + */ | |
42 | +#define rcu_read_unlock_sched() preempt_enable() | |
43 | + | |
44 | + | |
45 | + | |
46 | +/** | |
47 | * rcu_dereference - fetch an RCU-protected pointer in an | |
48 | * RCU read-side critical section. This pointer may later | |
49 | * be safely dereferenced. |