diff options
Diffstat (limited to 'kernel/smp.c')
-rw-r--r-- | kernel/smp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/smp.c b/kernel/smp.c index db197d60489b..a081e6ce0e0a 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -701,3 +701,32 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait) | |||
701 | return ret; | 701 | return ret; |
702 | } | 702 | } |
703 | EXPORT_SYMBOL(on_each_cpu); | 703 | EXPORT_SYMBOL(on_each_cpu); |
704 | |||
705 | /** | ||
706 | * on_each_cpu_mask(): Run a function on processors specified by | ||
707 | * cpumask, which may include the local processor. | ||
708 | * @mask: The set of cpus to run on (only runs on online subset). | ||
709 | * @func: The function to run. This must be fast and non-blocking. | ||
710 | * @info: An arbitrary pointer to pass to the function. | ||
711 | * @wait: If true, wait (atomically) until function has completed | ||
712 | * on other CPUs. | ||
713 | * | ||
714 | * If @wait is true, then returns once @func has returned. | ||
715 | * | ||
716 | * You must not call this function with disabled interrupts or | ||
717 | * from a hardware interrupt handler or from a bottom half handler. | ||
718 | */ | ||
719 | void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, | ||
720 | void *info, bool wait) | ||
721 | { | ||
722 | int cpu = get_cpu(); | ||
723 | |||
724 | smp_call_function_many(mask, func, info, wait); | ||
725 | if (cpumask_test_cpu(cpu, mask)) { | ||
726 | local_irq_disable(); | ||
727 | func(info); | ||
728 | local_irq_enable(); | ||
729 | } | ||
730 | put_cpu(); | ||
731 | } | ||
732 | EXPORT_SYMBOL(on_each_cpu_mask); | ||