diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-22 16:56:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-23 04:32:40 -0400 |
commit | f41d911f8c49a5d65c86504c19e8204bb605c4fd (patch) | |
tree | 59bcd3048652ef290b3e19d2904409afd5c90eb3 /kernel/rcutree_trace.c | |
parent | a157229cabd6dd8cfa82525fc9bf730c94cc9ac2 (diff) |
rcu: Merge preemptable-RCU functionality into hierarchical RCU
Create a kernel/rcutree_plugin.h file that contains definitions
for preemptable RCU (or, under the #else branch of the #ifdef,
empty definitions for the classic non-preemptable semantics).
These definitions fit into plugins defined in kernel/rcutree.c
for this purpose.
This variant of preemptable RCU uses a new algorithm whose
read-side expense is roughly that of classic hierarchical RCU
under CONFIG_PREEMPT. This new algorithm's update-side expense
is similar to that of classic hierarchical RCU, and, in absence
of read-side preemption or blocking, is exactly that of classic
hierarchical RCU. Perhaps more important, this new algorithm
has a much simpler implementation, saving well over 1,000 lines
of code compared to mainline's implementation of preemptable
RCU, which will hopefully be retired in favor of this new
algorithm.
The simplifications are obtained by maintaining per-task
nesting state for running tasks, and using a simple
lock-protected algorithm to handle accounting when tasks block
within RCU read-side critical sections, making use of lessons
learned while creating numerous user-level RCU implementations
over the past 18 months.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: akpm@linux-foundation.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: josht@linux.vnet.ibm.com
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
LKML-Reference: <12509746134003-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree_trace.c')
-rw-r--r-- | kernel/rcutree_trace.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c index 31af3a0fb6d5..0ea1bff69727 100644 --- a/kernel/rcutree_trace.c +++ b/kernel/rcutree_trace.c | |||
@@ -77,6 +77,10 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp) | |||
77 | 77 | ||
78 | static int show_rcudata(struct seq_file *m, void *unused) | 78 | static int show_rcudata(struct seq_file *m, void *unused) |
79 | { | 79 | { |
80 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
81 | seq_puts(m, "rcu_preempt:\n"); | ||
82 | PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data, m); | ||
83 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
80 | seq_puts(m, "rcu_sched:\n"); | 84 | seq_puts(m, "rcu_sched:\n"); |
81 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m); | 85 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data, m); |
82 | seq_puts(m, "rcu_bh:\n"); | 86 | seq_puts(m, "rcu_bh:\n"); |
@@ -125,6 +129,10 @@ static int show_rcudata_csv(struct seq_file *m, void *unused) | |||
125 | seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\","); | 129 | seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\","); |
126 | #endif /* #ifdef CONFIG_NO_HZ */ | 130 | #endif /* #ifdef CONFIG_NO_HZ */ |
127 | seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\"\n"); | 131 | seq_puts(m, "\"of\",\"ri\",\"ql\",\"b\"\n"); |
132 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
133 | seq_puts(m, "\"rcu_preempt:\"\n"); | ||
134 | PRINT_RCU_DATA(rcu_preempt_data, print_one_rcu_data_csv, m); | ||
135 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
128 | seq_puts(m, "\"rcu_sched:\"\n"); | 136 | seq_puts(m, "\"rcu_sched:\"\n"); |
129 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m); | 137 | PRINT_RCU_DATA(rcu_sched_data, print_one_rcu_data_csv, m); |
130 | seq_puts(m, "\"rcu_bh:\"\n"); | 138 | seq_puts(m, "\"rcu_bh:\"\n"); |
@@ -172,6 +180,10 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp) | |||
172 | 180 | ||
173 | static int show_rcuhier(struct seq_file *m, void *unused) | 181 | static int show_rcuhier(struct seq_file *m, void *unused) |
174 | { | 182 | { |
183 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
184 | seq_puts(m, "rcu_preempt:\n"); | ||
185 | print_one_rcu_state(m, &rcu_preempt_state); | ||
186 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
175 | seq_puts(m, "rcu_sched:\n"); | 187 | seq_puts(m, "rcu_sched:\n"); |
176 | print_one_rcu_state(m, &rcu_sched_state); | 188 | print_one_rcu_state(m, &rcu_sched_state); |
177 | seq_puts(m, "rcu_bh:\n"); | 189 | seq_puts(m, "rcu_bh:\n"); |
@@ -194,6 +206,10 @@ static struct file_operations rcuhier_fops = { | |||
194 | 206 | ||
195 | static int show_rcugp(struct seq_file *m, void *unused) | 207 | static int show_rcugp(struct seq_file *m, void *unused) |
196 | { | 208 | { |
209 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
210 | seq_printf(m, "rcu_preempt: completed=%ld gpnum=%ld\n", | ||
211 | rcu_preempt_state.completed, rcu_preempt_state.gpnum); | ||
212 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
197 | seq_printf(m, "rcu_sched: completed=%ld gpnum=%ld\n", | 213 | seq_printf(m, "rcu_sched: completed=%ld gpnum=%ld\n", |
198 | rcu_sched_state.completed, rcu_sched_state.gpnum); | 214 | rcu_sched_state.completed, rcu_sched_state.gpnum); |
199 | seq_printf(m, "rcu_bh: completed=%ld gpnum=%ld\n", | 215 | seq_printf(m, "rcu_bh: completed=%ld gpnum=%ld\n", |
@@ -244,6 +260,10 @@ static void print_rcu_pendings(struct seq_file *m, struct rcu_state *rsp) | |||
244 | 260 | ||
245 | static int show_rcu_pending(struct seq_file *m, void *unused) | 261 | static int show_rcu_pending(struct seq_file *m, void *unused) |
246 | { | 262 | { |
263 | #ifdef CONFIG_TREE_PREEMPT_RCU | ||
264 | seq_puts(m, "rcu_preempt:\n"); | ||
265 | print_rcu_pendings(m, &rcu_preempt_state); | ||
266 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | ||
247 | seq_puts(m, "rcu_sched:\n"); | 267 | seq_puts(m, "rcu_sched:\n"); |
248 | print_rcu_pendings(m, &rcu_sched_state); | 268 | print_rcu_pendings(m, &rcu_sched_state); |
249 | seq_puts(m, "rcu_bh:\n"); | 269 | seq_puts(m, "rcu_bh:\n"); |