Messages in this thread Patch in this message | | | From | Thomas Schlichter <> | Subject | Re: [PATCH][2.5] fix preempt-issues with smp_call_function() | Date | Wed, 26 Feb 2003 11:52:45 +0100 |
| |
Dave Jones <davej@codemonkey.org.uk> wrote: > btw, (unrelated) shouldn't smp_call_function be doing magick checks > with cpu_online() ?
Andrew Morton wrote: > Looks OK? It sprays the IPI out to all the other CPUs in cpu_online_map, > and waits for num_online_cpus()-1 CPUs to answer. > > All very racy in the presence of CPUs going offline, but that's all over > the place. Depends how the offlining will be done I guess.
Well, now I see the check for num_online_cpus() != 1 in smp_call_function(), too, so the check in on_each_cpu() is not needed and possibly better this patch should apply to the include/linux/smp.h file...
Thomas
--- linux-2.5.63/include/linux/smp.h.orig Mon Feb 24 20:05:33 2003 +++ linux-2.5.63/include/linux/smp.h Wed Feb 26 11:41:45 2003 @@ -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,24 @@ 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; + + 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 +115,7 @@ #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[unhandled content-type:application/pgp-signature] | |