summaryrefslogtreecommitdiff
path: root/include/linux/smp.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-11-17 14:27:27 -0800
committerThomas Gleixner <tglx@linutronix.de>2009-11-18 14:52:25 +0100
commit2ea6dec4a22a6f66f6633876212fd4d195cf8277 (patch)
treef630c63a9e20fab5b31caa88368293a203103408 /include/linux/smp.h
parent72f279b256d520e321a850880d094bc0bcbf45d6 (diff)
downloadlwn-2ea6dec4a22a6f66f6633876212fd4d195cf8277.tar.gz
lwn-2ea6dec4a22a6f66f6633876212fd4d195cf8277.zip
generic-ipi: Add smp_call_function_any()
Andrew points out that acpi-cpufreq uses cpumask_any, when it really would prefer to use the same CPU if possible (to avoid an IPI). In general, this seems a good idea to offer. [ tglx: Documented selection preference and Inlined the UP case to avoid the copy of smp_call_function_single() and the extra EXPORT ] Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Ingo Molnar <mingo@elte.hu> Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Cc: Len Brown <len.brown@intel.com> Cc: Zhao Yakui <yakui.zhao@intel.com> Cc: Dave Jones <davej@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Mike Galbraith <efault@gmx.de> Cc: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/smp.h')
-rw-r--r--include/linux/smp.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 39c64bae776d..7a0570e6a596 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -76,6 +76,9 @@ void smp_call_function_many(const struct cpumask *mask,
void __smp_call_function_single(int cpuid, struct call_single_data *data,
int wait);
+int smp_call_function_any(const struct cpumask *mask,
+ void (*func)(void *info), void *info, int wait);
+
/*
* Generic and arch helpers
*/
@@ -137,9 +140,15 @@ static inline void smp_send_reschedule(int cpu) { }
#define smp_prepare_boot_cpu() do {} while (0)
#define smp_call_function_many(mask, func, info, wait) \
(up_smp_call_function(func, info))
-static inline void init_call_single_data(void)
+static inline void init_call_single_data(void) { }
+
+static inline int
+smp_call_function_any(const struct cpumask *mask, void (*func)(void *info),
+ void *info, int wait)
{
+ return smp_call_function_single(0, func, info, wait);
}
+
#endif /* !SMP */
/*