diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-22 16:56:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-23 04:32:37 -0400 |
commit | d6714c22b43fbcbead7e7b706ff270e15f04a791 (patch) | |
tree | 1dc15e57d982351bed45b7b9768a118f86b88c19 /kernel/rcutree.c | |
parent | 9f77da9f40045253e91f55c12d4481254b513d2d (diff) |
rcu: Renamings to increase RCU clarity
Make RCU-sched, RCU-bh, and RCU-preempt be underlying
implementations, with "RCU" defined in terms of one of the
three. Update the outdated rcu_qsctr_inc() names, as these
functions no longer increment anything.
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: <12509746132696-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 80 |
1 files changed, 50 insertions, 30 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index a162f859dd32..4d71d4e8b5a8 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -74,26 +74,25 @@ EXPORT_SYMBOL_GPL(rcu_lock_map); | |||
74 | .n_force_qs_ngp = 0, \ | 74 | .n_force_qs_ngp = 0, \ |
75 | } | 75 | } |
76 | 76 | ||
77 | struct rcu_state rcu_state = RCU_STATE_INITIALIZER(rcu_state); | 77 | struct rcu_state rcu_sched_state = RCU_STATE_INITIALIZER(rcu_sched_state); |
78 | DEFINE_PER_CPU(struct rcu_data, rcu_data); | 78 | DEFINE_PER_CPU(struct rcu_data, rcu_sched_data); |
79 | 79 | ||
80 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); | 80 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); |
81 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); | 81 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * Increment the quiescent state counter. | 84 | * Note a quiescent state. Because we do not need to know |
85 | * The counter is a bit degenerated: We do not need to know | ||
86 | * how many quiescent states passed, just if there was at least | 85 | * how many quiescent states passed, just if there was at least |
87 | * one since the start of the grace period. Thus just a flag. | 86 | * one since the start of the grace period, this just sets a flag. |
88 | */ | 87 | */ |
89 | void rcu_qsctr_inc(int cpu) | 88 | void rcu_sched_qs(int cpu) |
90 | { | 89 | { |
91 | struct rcu_data *rdp = &per_cpu(rcu_data, cpu); | 90 | struct rcu_data *rdp = &per_cpu(rcu_sched_data, cpu); |
92 | rdp->passed_quiesc = 1; | 91 | rdp->passed_quiesc = 1; |
93 | rdp->passed_quiesc_completed = rdp->completed; | 92 | rdp->passed_quiesc_completed = rdp->completed; |
94 | } | 93 | } |
95 | 94 | ||
96 | void rcu_bh_qsctr_inc(int cpu) | 95 | void rcu_bh_qs(int cpu) |
97 | { | 96 | { |
98 | struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu); | 97 | struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu); |
99 | rdp->passed_quiesc = 1; | 98 | rdp->passed_quiesc = 1; |
@@ -114,11 +113,21 @@ static int qlowmark = 100; /* Once only this many pending, use blimit. */ | |||
114 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed); | 113 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed); |
115 | 114 | ||
116 | /* | 115 | /* |
116 | * Return the number of RCU-sched batches processed thus far for debug & stats. | ||
117 | */ | ||
118 | long rcu_batches_completed_sched(void) | ||
119 | { | ||
120 | return rcu_sched_state.completed; | ||
121 | } | ||
122 | EXPORT_SYMBOL_GPL(rcu_batches_completed_sched); | ||
123 | |||
124 | /* | ||
117 | * Return the number of RCU batches processed thus far for debug & stats. | 125 | * Return the number of RCU batches processed thus far for debug & stats. |
126 | * @@@ placeholder, maps to rcu_batches_completed_sched(). | ||
118 | */ | 127 | */ |
119 | long rcu_batches_completed(void) | 128 | long rcu_batches_completed(void) |
120 | { | 129 | { |
121 | return rcu_state.completed; | 130 | return rcu_batches_completed_sched(); |
122 | } | 131 | } |
123 | EXPORT_SYMBOL_GPL(rcu_batches_completed); | 132 | EXPORT_SYMBOL_GPL(rcu_batches_completed); |
124 | 133 | ||
@@ -310,7 +319,7 @@ void rcu_irq_exit(void) | |||
310 | WARN_ON_RATELIMIT(rdtp->dynticks & 0x1, &rcu_rs); | 319 | WARN_ON_RATELIMIT(rdtp->dynticks & 0x1, &rcu_rs); |
311 | 320 | ||
312 | /* If the interrupt queued a callback, get out of dyntick mode. */ | 321 | /* If the interrupt queued a callback, get out of dyntick mode. */ |
313 | if (__get_cpu_var(rcu_data).nxtlist || | 322 | if (__get_cpu_var(rcu_sched_data).nxtlist || |
314 | __get_cpu_var(rcu_bh_data).nxtlist) | 323 | __get_cpu_var(rcu_bh_data).nxtlist) |
315 | set_need_resched(); | 324 | set_need_resched(); |
316 | } | 325 | } |
@@ -847,7 +856,7 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp) | |||
847 | /* | 856 | /* |
848 | * Move callbacks from the outgoing CPU to the running CPU. | 857 | * Move callbacks from the outgoing CPU to the running CPU. |
849 | * Note that the outgoing CPU is now quiscent, so it is now | 858 | * Note that the outgoing CPU is now quiscent, so it is now |
850 | * (uncharacteristically) safe to access it rcu_data structure. | 859 | * (uncharacteristically) safe to access its rcu_data structure. |
851 | * Note also that we must carefully retain the order of the | 860 | * Note also that we must carefully retain the order of the |
852 | * outgoing CPU's callbacks in order for rcu_barrier() to work | 861 | * outgoing CPU's callbacks in order for rcu_barrier() to work |
853 | * correctly. Finally, note that we start all the callbacks | 862 | * correctly. Finally, note that we start all the callbacks |
@@ -878,7 +887,7 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp) | |||
878 | */ | 887 | */ |
879 | static void rcu_offline_cpu(int cpu) | 888 | static void rcu_offline_cpu(int cpu) |
880 | { | 889 | { |
881 | __rcu_offline_cpu(cpu, &rcu_state); | 890 | __rcu_offline_cpu(cpu, &rcu_sched_state); |
882 | __rcu_offline_cpu(cpu, &rcu_bh_state); | 891 | __rcu_offline_cpu(cpu, &rcu_bh_state); |
883 | } | 892 | } |
884 | 893 | ||
@@ -973,17 +982,16 @@ void rcu_check_callbacks(int cpu, int user) | |||
973 | * Get here if this CPU took its interrupt from user | 982 | * Get here if this CPU took its interrupt from user |
974 | * mode or from the idle loop, and if this is not a | 983 | * mode or from the idle loop, and if this is not a |
975 | * nested interrupt. In this case, the CPU is in | 984 | * nested interrupt. In this case, the CPU is in |
976 | * a quiescent state, so count it. | 985 | * a quiescent state, so note it. |
977 | * | 986 | * |
978 | * No memory barrier is required here because both | 987 | * No memory barrier is required here because both |
979 | * rcu_qsctr_inc() and rcu_bh_qsctr_inc() reference | 988 | * rcu_sched_qs() and rcu_bh_qs() reference only CPU-local |
980 | * only CPU-local variables that other CPUs neither | 989 | * variables that other CPUs neither access nor modify, |
981 | * access nor modify, at least not while the corresponding | 990 | * at least not while the corresponding CPU is online. |
982 | * CPU is online. | ||
983 | */ | 991 | */ |
984 | 992 | ||
985 | rcu_qsctr_inc(cpu); | 993 | rcu_sched_qs(cpu); |
986 | rcu_bh_qsctr_inc(cpu); | 994 | rcu_bh_qs(cpu); |
987 | 995 | ||
988 | } else if (!in_softirq()) { | 996 | } else if (!in_softirq()) { |
989 | 997 | ||
@@ -991,10 +999,10 @@ void rcu_check_callbacks(int cpu, int user) | |||
991 | * Get here if this CPU did not take its interrupt from | 999 | * Get here if this CPU did not take its interrupt from |
992 | * softirq, in other words, if it is not interrupting | 1000 | * softirq, in other words, if it is not interrupting |
993 | * a rcu_bh read-side critical section. This is an _bh | 1001 | * a rcu_bh read-side critical section. This is an _bh |
994 | * critical section, so count it. | 1002 | * critical section, so note it. |
995 | */ | 1003 | */ |
996 | 1004 | ||
997 | rcu_bh_qsctr_inc(cpu); | 1005 | rcu_bh_qs(cpu); |
998 | } | 1006 | } |
999 | raise_softirq(RCU_SOFTIRQ); | 1007 | raise_softirq(RCU_SOFTIRQ); |
1000 | } | 1008 | } |
@@ -1174,7 +1182,8 @@ static void rcu_process_callbacks(struct softirq_action *unused) | |||
1174 | */ | 1182 | */ |
1175 | smp_mb(); /* See above block comment. */ | 1183 | smp_mb(); /* See above block comment. */ |
1176 | 1184 | ||
1177 | __rcu_process_callbacks(&rcu_state, &__get_cpu_var(rcu_data)); | 1185 | __rcu_process_callbacks(&rcu_sched_state, |
1186 | &__get_cpu_var(rcu_sched_data)); | ||
1178 | __rcu_process_callbacks(&rcu_bh_state, &__get_cpu_var(rcu_bh_data)); | 1187 | __rcu_process_callbacks(&rcu_bh_state, &__get_cpu_var(rcu_bh_data)); |
1179 | 1188 | ||
1180 | /* | 1189 | /* |
@@ -1231,14 +1240,25 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu), | |||
1231 | } | 1240 | } |
1232 | 1241 | ||
1233 | /* | 1242 | /* |
1234 | * Queue an RCU callback for invocation after a grace period. | 1243 | * Queue an RCU-sched callback for invocation after a grace period. |
1244 | */ | ||
1245 | void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) | ||
1246 | { | ||
1247 | __call_rcu(head, func, &rcu_sched_state); | ||
1248 | } | ||
1249 | EXPORT_SYMBOL_GPL(call_rcu_sched); | ||
1250 | |||
1251 | /* | ||
1252 | * @@@ Queue an RCU callback for invocation after a grace period. | ||
1253 | * @@@ Placeholder pending rcutree_plugin.h. | ||
1235 | */ | 1254 | */ |
1236 | void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) | 1255 | void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) |
1237 | { | 1256 | { |
1238 | __call_rcu(head, func, &rcu_state); | 1257 | call_rcu_sched(head, func); |
1239 | } | 1258 | } |
1240 | EXPORT_SYMBOL_GPL(call_rcu); | 1259 | EXPORT_SYMBOL_GPL(call_rcu); |
1241 | 1260 | ||
1261 | |||
1242 | /* | 1262 | /* |
1243 | * Queue an RCU for invocation after a quicker grace period. | 1263 | * Queue an RCU for invocation after a quicker grace period. |
1244 | */ | 1264 | */ |
@@ -1311,7 +1331,7 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1311 | */ | 1331 | */ |
1312 | int rcu_pending(int cpu) | 1332 | int rcu_pending(int cpu) |
1313 | { | 1333 | { |
1314 | return __rcu_pending(&rcu_state, &per_cpu(rcu_data, cpu)) || | 1334 | return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) || |
1315 | __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)); | 1335 | __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)); |
1316 | } | 1336 | } |
1317 | 1337 | ||
@@ -1324,7 +1344,7 @@ int rcu_pending(int cpu) | |||
1324 | int rcu_needs_cpu(int cpu) | 1344 | int rcu_needs_cpu(int cpu) |
1325 | { | 1345 | { |
1326 | /* RCU callbacks either ready or pending? */ | 1346 | /* RCU callbacks either ready or pending? */ |
1327 | return per_cpu(rcu_data, cpu).nxtlist || | 1347 | return per_cpu(rcu_sched_data, cpu).nxtlist || |
1328 | per_cpu(rcu_bh_data, cpu).nxtlist; | 1348 | per_cpu(rcu_bh_data, cpu).nxtlist; |
1329 | } | 1349 | } |
1330 | 1350 | ||
@@ -1418,7 +1438,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp) | |||
1418 | 1438 | ||
1419 | static void __cpuinit rcu_online_cpu(int cpu) | 1439 | static void __cpuinit rcu_online_cpu(int cpu) |
1420 | { | 1440 | { |
1421 | rcu_init_percpu_data(cpu, &rcu_state); | 1441 | rcu_init_percpu_data(cpu, &rcu_sched_state); |
1422 | rcu_init_percpu_data(cpu, &rcu_bh_state); | 1442 | rcu_init_percpu_data(cpu, &rcu_bh_state); |
1423 | } | 1443 | } |
1424 | 1444 | ||
@@ -1545,10 +1565,10 @@ void __init __rcu_init(void) | |||
1545 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 1565 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
1546 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); | 1566 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); |
1547 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | 1567 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ |
1548 | rcu_init_one(&rcu_state); | 1568 | rcu_init_one(&rcu_sched_state); |
1549 | RCU_DATA_PTR_INIT(&rcu_state, rcu_data); | 1569 | RCU_DATA_PTR_INIT(&rcu_sched_state, rcu_sched_data); |
1550 | for_each_possible_cpu(i) | 1570 | for_each_possible_cpu(i) |
1551 | rcu_boot_init_percpu_data(i, &rcu_state); | 1571 | rcu_boot_init_percpu_data(i, &rcu_sched_state); |
1552 | rcu_init_one(&rcu_bh_state); | 1572 | rcu_init_one(&rcu_bh_state); |
1553 | RCU_DATA_PTR_INIT(&rcu_bh_state, rcu_bh_data); | 1573 | RCU_DATA_PTR_INIT(&rcu_bh_state, rcu_bh_data); |
1554 | for_each_possible_cpu(i) | 1574 | for_each_possible_cpu(i) |