diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2009-01-09 15:27:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-10 21:41:58 -0500 |
commit | 53ce3d9564908794ae7dd32969089b57df5fc098 (patch) | |
tree | d0eb540d9743155eff6d3c454db3493bf75c9023 /include | |
parent | abede81c4fb2e3b85d8760f25e3da39d2c69a134 (diff) |
smp_call_function_single(): be slightly less stupid
If you do
smp_call_function_single(expression-with-side-effects, ...)
then expression-with-side-effects never gets evaluated on UP builds.
As always, implementing it in C is the correct thing to do.
While we're there, uninline it for size and possible header dependency
reasons.
And create a new kernel/up.c, as a place in which to put
uniprocessor-specific code and storage. It should mirror kernel/smp.c.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/smp.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/include/linux/smp.h b/include/linux/smp.h index b82466968101..715196b09d67 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -24,6 +24,9 @@ struct call_single_data { | |||
24 | /* total number of cpus in this system (may exceed NR_CPUS) */ | 24 | /* total number of cpus in this system (may exceed NR_CPUS) */ |
25 | extern unsigned int total_cpus; | 25 | extern unsigned int total_cpus; |
26 | 26 | ||
27 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | ||
28 | int wait); | ||
29 | |||
27 | #ifdef CONFIG_SMP | 30 | #ifdef CONFIG_SMP |
28 | 31 | ||
29 | #include <linux/preempt.h> | 32 | #include <linux/preempt.h> |
@@ -79,8 +82,6 @@ smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | |||
79 | return 0; | 82 | return 0; |
80 | } | 83 | } |
81 | 84 | ||
82 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | ||
83 | int wait); | ||
84 | void __smp_call_function_single(int cpuid, struct call_single_data *data); | 85 | void __smp_call_function_single(int cpuid, struct call_single_data *data); |
85 | 86 | ||
86 | /* | 87 | /* |
@@ -140,14 +141,6 @@ static inline int up_smp_call_function(void (*func)(void *), void *info) | |||
140 | static inline void smp_send_reschedule(int cpu) { } | 141 | static inline void smp_send_reschedule(int cpu) { } |
141 | #define num_booting_cpus() 1 | 142 | #define num_booting_cpus() 1 |
142 | #define smp_prepare_boot_cpu() do {} while (0) | 143 | #define smp_prepare_boot_cpu() do {} while (0) |
143 | #define smp_call_function_single(cpuid, func, info, wait) \ | ||
144 | ({ \ | ||
145 | WARN_ON(cpuid != 0); \ | ||
146 | local_irq_disable(); \ | ||
147 | (func)(info); \ | ||
148 | local_irq_enable(); \ | ||
149 | 0; \ | ||
150 | }) | ||
151 | #define smp_call_function_mask(mask, func, info, wait) \ | 144 | #define smp_call_function_mask(mask, func, info, wait) \ |
152 | (up_smp_call_function(func, info)) | 145 | (up_smp_call_function(func, info)) |
153 | #define smp_call_function_many(mask, func, info, wait) \ | 146 | #define smp_call_function_many(mask, func, info, wait) \ |