diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-11-22 11:53:49 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-22 12:58:16 -0500 |
commit | 9f680ab41485edfdc96331b70afa7513aa0a7720 (patch) | |
tree | 620b34f8129c0ea4ddee033c9875a9f60bfba2ae | |
parent | b668c9cf3e58739dac54a1d6f42f2b4bdd980b3e (diff) |
rcu: Eliminate unneeded function wrapping
The functions rcu_init() is a wrapper for __rcu_init(), and also
sets up the CPU-hotplug notifier for rcu_barrier_cpu_hotplug().
But TINY_RCU doesn't need CPU-hotplug notification, and the
rcu_barrier_cpu_hotplug() is a simple wrapper for
rcu_cpu_notify().
So push rcu_init() out to kernel/rcutree.c and kernel/rcutiny.c
and get rid of the wrapper function rcu_barrier_cpu_hotplug().
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <12589088302320-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/rcutiny.h | 2 | ||||
-rw-r--r-- | include/linux/rcutree.h | 3 | ||||
-rw-r--r-- | kernel/rcupdate.c | 22 | ||||
-rw-r--r-- | kernel/rcutiny.c | 11 | ||||
-rw-r--r-- | kernel/rcutree.c | 17 |
5 files changed, 15 insertions, 40 deletions
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 2c1fe8373e71..a3b6272af2dd 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
@@ -38,7 +38,6 @@ void rcu_bh_qs(int cpu); | |||
38 | 38 | ||
39 | #define rcu_init_sched() do { } while (0) | 39 | #define rcu_init_sched() do { } while (0) |
40 | extern void rcu_check_callbacks(int cpu, int user); | 40 | extern void rcu_check_callbacks(int cpu, int user); |
41 | extern void __rcu_init(void); | ||
42 | 41 | ||
43 | /* | 42 | /* |
44 | * Return the number of grace periods. | 43 | * Return the number of grace periods. |
@@ -69,7 +68,6 @@ static inline void synchronize_rcu_bh_expedited(void) | |||
69 | } | 68 | } |
70 | 69 | ||
71 | struct notifier_block; | 70 | struct notifier_block; |
72 | extern int rcu_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu); | ||
73 | 71 | ||
74 | #ifdef CONFIG_NO_HZ | 72 | #ifdef CONFIG_NO_HZ |
75 | 73 | ||
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 9642c6bcb399..111a65257350 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -34,8 +34,6 @@ struct notifier_block; | |||
34 | 34 | ||
35 | extern void rcu_sched_qs(int cpu); | 35 | extern void rcu_sched_qs(int cpu); |
36 | extern void rcu_bh_qs(int cpu); | 36 | extern void rcu_bh_qs(int cpu); |
37 | extern int rcu_cpu_notify(struct notifier_block *self, | ||
38 | unsigned long action, void *hcpu); | ||
39 | extern int rcu_needs_cpu(int cpu); | 37 | extern int rcu_needs_cpu(int cpu); |
40 | extern int rcu_expedited_torture_stats(char *page); | 38 | extern int rcu_expedited_torture_stats(char *page); |
41 | 39 | ||
@@ -83,7 +81,6 @@ static inline void synchronize_rcu_bh_expedited(void) | |||
83 | synchronize_sched_expedited(); | 81 | synchronize_sched_expedited(); |
84 | } | 82 | } |
85 | 83 | ||
86 | extern void __rcu_init(void); | ||
87 | extern void rcu_check_callbacks(int cpu, int user); | 84 | extern void rcu_check_callbacks(int cpu, int user); |
88 | 85 | ||
89 | extern long rcu_batches_completed(void); | 86 | extern long rcu_batches_completed(void); |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 7625f207f65e..eb6b534db318 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -161,28 +161,6 @@ EXPORT_SYMBOL_GPL(synchronize_rcu_bh); | |||
161 | 161 | ||
162 | #endif /* #ifndef CONFIG_TINY_RCU */ | 162 | #endif /* #ifndef CONFIG_TINY_RCU */ |
163 | 163 | ||
164 | static int __cpuinit rcu_barrier_cpu_hotplug(struct notifier_block *self, | ||
165 | unsigned long action, void *hcpu) | ||
166 | { | ||
167 | return rcu_cpu_notify(self, action, hcpu); | ||
168 | } | ||
169 | |||
170 | void __init rcu_init(void) | ||
171 | { | ||
172 | int i; | ||
173 | |||
174 | __rcu_init(); | ||
175 | cpu_notifier(rcu_barrier_cpu_hotplug, 0); | ||
176 | |||
177 | /* | ||
178 | * We don't need protection against CPU-hotplug here because | ||
179 | * this is called early in boot, before either interrupts | ||
180 | * or the scheduler are operational. | ||
181 | */ | ||
182 | for_each_online_cpu(i) | ||
183 | rcu_barrier_cpu_hotplug(NULL, CPU_UP_PREPARE, (void *)(long)i); | ||
184 | } | ||
185 | |||
186 | void rcu_scheduler_starting(void) | 164 | void rcu_scheduler_starting(void) |
187 | { | 165 | { |
188 | WARN_ON(num_online_cpus() != 1); | 166 | WARN_ON(num_online_cpus() != 1); |
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index b33ec3aa377a..9f6d9ff2572c 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c | |||
@@ -178,15 +178,6 @@ static void rcu_process_callbacks(struct softirq_action *unused) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * Null function to handle CPU being onlined. Longer term, we want to | ||
182 | * make TINY_RCU avoid using rcupdate.c, but later... | ||
183 | */ | ||
184 | int rcu_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) | ||
185 | { | ||
186 | return NOTIFY_OK; | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * Wait for a grace period to elapse. But it is illegal to invoke | 181 | * Wait for a grace period to elapse. But it is illegal to invoke |
191 | * synchronize_sched() from within an RCU read-side critical section. | 182 | * synchronize_sched() from within an RCU read-side critical section. |
192 | * Therefore, any legal call to synchronize_sched() is a quiescent | 183 | * Therefore, any legal call to synchronize_sched() is a quiescent |
@@ -285,7 +276,7 @@ void rcu_barrier_sched(void) | |||
285 | } | 276 | } |
286 | EXPORT_SYMBOL_GPL(rcu_barrier_sched); | 277 | EXPORT_SYMBOL_GPL(rcu_barrier_sched); |
287 | 278 | ||
288 | void __rcu_init(void) | 279 | void __init rcu_init(void) |
289 | { | 280 | { |
290 | open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); | 281 | open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); |
291 | } | 282 | } |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index b79bfcd28e95..e3d3bbddbcd5 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1644,8 +1644,8 @@ static void __cpuinit rcu_online_cpu(int cpu) | |||
1644 | /* | 1644 | /* |
1645 | * Handle CPU online/offline notification events. | 1645 | * Handle CPU online/offline notification events. |
1646 | */ | 1646 | */ |
1647 | int __cpuinit rcu_cpu_notify(struct notifier_block *self, | 1647 | static int __cpuinit rcu_cpu_notify(struct notifier_block *self, |
1648 | unsigned long action, void *hcpu) | 1648 | unsigned long action, void *hcpu) |
1649 | { | 1649 | { |
1650 | long cpu = (long)hcpu; | 1650 | long cpu = (long)hcpu; |
1651 | 1651 | ||
@@ -1781,8 +1781,10 @@ do { \ | |||
1781 | } \ | 1781 | } \ |
1782 | } while (0) | 1782 | } while (0) |
1783 | 1783 | ||
1784 | void __init __rcu_init(void) | 1784 | void __init rcu_init(void) |
1785 | { | 1785 | { |
1786 | int i; | ||
1787 | |||
1786 | rcu_bootup_announce(); | 1788 | rcu_bootup_announce(); |
1787 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 1789 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
1788 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); | 1790 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); |
@@ -1791,6 +1793,15 @@ void __init __rcu_init(void) | |||
1791 | RCU_INIT_FLAVOR(&rcu_bh_state, rcu_bh_data); | 1793 | RCU_INIT_FLAVOR(&rcu_bh_state, rcu_bh_data); |
1792 | __rcu_init_preempt(); | 1794 | __rcu_init_preempt(); |
1793 | open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); | 1795 | open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); |
1796 | |||
1797 | /* | ||
1798 | * We don't need protection against CPU-hotplug here because | ||
1799 | * this is called early in boot, before either interrupts | ||
1800 | * or the scheduler are operational. | ||
1801 | */ | ||
1802 | cpu_notifier(rcu_cpu_notify, 0); | ||
1803 | for_each_online_cpu(i) | ||
1804 | rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)i); | ||
1794 | } | 1805 | } |
1795 | 1806 | ||
1796 | #include "rcutree_plugin.h" | 1807 | #include "rcutree_plugin.h" |