diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2008-01-25 15:08:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:24 -0500 |
commit | e260be673a15b6125068270e0216a3bfbfc12f87 (patch) | |
tree | f50760606d395bf6faa9e865f814761a3c88d32c /include/linux/rcupreempt_trace.h | |
parent | e0ecfa7917cafe72f4a75f87e8bb5d8d51dc534f (diff) |
Preempt-RCU: implementation
This patch implements a new version of RCU which allows its read-side
critical sections to be preempted. It uses a set of counter pairs
to keep track of the read-side critical sections and flips them
when all tasks exit read-side critical section. The details
of this implementation can be found in this paper -
http://www.rdrop.com/users/paulmck/RCU/OLSrtRCU.2006.08.11a.pdf
and the article-
http://lwn.net/Articles/253651/
This patch was developed as a part of the -rt kernel development and
meant to provide better latencies when read-side critical sections of
RCU don't disable preemption. As a consequence of keeping track of RCU
readers, the readers have a slight overhead (optimizations in the paper).
This implementation co-exists with the "classic" RCU implementations
and can be switched to at compiler.
Also includes RCU tracing summarized in debugfs.
[ akpm@linux-foundation.org: build fixes on non-preempt architectures ]
Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@us.ibm.com>
Reviewed-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/rcupreempt_trace.h')
-rw-r--r-- | include/linux/rcupreempt_trace.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h new file mode 100644 index 000000000000..21cd6b2a5c42 --- /dev/null +++ b/include/linux/rcupreempt_trace.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Read-Copy Update mechanism for mutual exclusion (RT implementation) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * Copyright (C) IBM Corporation, 2006 | ||
19 | * | ||
20 | * Author: Paul McKenney <paulmck@us.ibm.com> | ||
21 | * | ||
22 | * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com> | ||
23 | * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. | ||
24 | * Papers: | ||
25 | * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf | ||
26 | * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) | ||
27 | * | ||
28 | * For detailed explanation of the Preemptible Read-Copy Update mechanism see - | ||
29 | * http://lwn.net/Articles/253651/ | ||
30 | */ | ||
31 | |||
32 | #ifndef __LINUX_RCUPREEMPT_TRACE_H | ||
33 | #define __LINUX_RCUPREEMPT_TRACE_H | ||
34 | |||
35 | #ifdef __KERNEL__ | ||
36 | #include <linux/types.h> | ||
37 | #include <linux/kernel.h> | ||
38 | |||
39 | #include <asm/atomic.h> | ||
40 | |||
41 | /* | ||
42 | * PREEMPT_RCU data structures. | ||
43 | */ | ||
44 | |||
45 | struct rcupreempt_trace { | ||
46 | long next_length; | ||
47 | long next_add; | ||
48 | long wait_length; | ||
49 | long wait_add; | ||
50 | long done_length; | ||
51 | long done_add; | ||
52 | long done_remove; | ||
53 | atomic_t done_invoked; | ||
54 | long rcu_check_callbacks; | ||
55 | atomic_t rcu_try_flip_1; | ||
56 | atomic_t rcu_try_flip_e1; | ||
57 | long rcu_try_flip_i1; | ||
58 | long rcu_try_flip_ie1; | ||
59 | long rcu_try_flip_g1; | ||
60 | long rcu_try_flip_a1; | ||
61 | long rcu_try_flip_ae1; | ||
62 | long rcu_try_flip_a2; | ||
63 | long rcu_try_flip_z1; | ||
64 | long rcu_try_flip_ze1; | ||
65 | long rcu_try_flip_z2; | ||
66 | long rcu_try_flip_m1; | ||
67 | long rcu_try_flip_me1; | ||
68 | long rcu_try_flip_m2; | ||
69 | }; | ||
70 | |||
71 | #ifdef CONFIG_RCU_TRACE | ||
72 | #define RCU_TRACE(fn, arg) fn(arg); | ||
73 | #else | ||
74 | #define RCU_TRACE(fn, arg) | ||
75 | #endif | ||
76 | |||
77 | extern void rcupreempt_trace_move2done(struct rcupreempt_trace *trace); | ||
78 | extern void rcupreempt_trace_move2wait(struct rcupreempt_trace *trace); | ||
79 | extern void rcupreempt_trace_try_flip_1(struct rcupreempt_trace *trace); | ||
80 | extern void rcupreempt_trace_try_flip_e1(struct rcupreempt_trace *trace); | ||
81 | extern void rcupreempt_trace_try_flip_i1(struct rcupreempt_trace *trace); | ||
82 | extern void rcupreempt_trace_try_flip_ie1(struct rcupreempt_trace *trace); | ||
83 | extern void rcupreempt_trace_try_flip_g1(struct rcupreempt_trace *trace); | ||
84 | extern void rcupreempt_trace_try_flip_a1(struct rcupreempt_trace *trace); | ||
85 | extern void rcupreempt_trace_try_flip_ae1(struct rcupreempt_trace *trace); | ||
86 | extern void rcupreempt_trace_try_flip_a2(struct rcupreempt_trace *trace); | ||
87 | extern void rcupreempt_trace_try_flip_z1(struct rcupreempt_trace *trace); | ||
88 | extern void rcupreempt_trace_try_flip_ze1(struct rcupreempt_trace *trace); | ||
89 | extern void rcupreempt_trace_try_flip_z2(struct rcupreempt_trace *trace); | ||
90 | extern void rcupreempt_trace_try_flip_m1(struct rcupreempt_trace *trace); | ||
91 | extern void rcupreempt_trace_try_flip_me1(struct rcupreempt_trace *trace); | ||
92 | extern void rcupreempt_trace_try_flip_m2(struct rcupreempt_trace *trace); | ||
93 | extern void rcupreempt_trace_check_callbacks(struct rcupreempt_trace *trace); | ||
94 | extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace); | ||
95 | extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace); | ||
96 | extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace); | ||
97 | |||
98 | #endif /* __KERNEL__ */ | ||
99 | #endif /* __LINUX_RCUPREEMPT_TRACE_H */ | ||