diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-03-02 04:36:59 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-03-02 04:36:59 -0800 |
| commit | a8dd64846059efc677f37fbd2c0665def355885f (patch) | |
| tree | eda257cb424b85e3b2500c36bc0103ea4e743b58 /include/linux | |
| parent | e8375b8c74b43df9049059f06d9a64cc376f2ff1 (diff) | |
[PATCH] fix preempt-issues with smp_call_function()
Patch from Thomas Schlichter <schlicht@uni-mannheim.de>
Based on a patch from Dave Jones.
It converts a large number of instances of:
smp_call_function(foo);
foo();
into
on_each_cpu(foo);
and in doing so fixes up the preempt-unsafeness of the first version.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/smp.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/smp.h b/include/linux/smp.h index ce016a544cd4..81a906924efe 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -10,9 +10,10 @@ #ifdef CONFIG_SMP +#include <linux/preempt.h> #include <linux/kernel.h> #include <linux/compiler.h> -#include <linux/threads.h> +#include <linux/thread_info.h> #include <asm/smp.h> #include <asm/bug.h> @@ -54,6 +55,21 @@ extern int smp_call_function (void (*func) (void *info), void *info, int retry, int wait); /* + * Call a function on all processors + */ +static inline int on_each_cpu(void (*func) (void *info), void *info, + int retry, int wait) +{ + int ret = 0; + + preempt_disable(); + ret = smp_call_function(func, info, retry, wait); + func(info); + preempt_enable(); + return ret; +} + +/* * True once the per process idle is forked */ extern int smp_threads_ready; @@ -96,6 +112,7 @@ void smp_prepare_boot_cpu(void); #define hard_smp_processor_id() 0 #define smp_threads_ready 1 #define smp_call_function(func,info,retry,wait) ({ 0; }) +#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) static inline void smp_send_reschedule(int cpu) { } static inline void smp_send_reschedule_all(void) { } #define cpu_online_map 1 |
