Commit d7877c03 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Jens Axboe

smp: Move __smp_call_function_single() below its safe version

Move this function closer to __smp_call_function_single(). These functions
have very similar behavior and should be displayed in the same block
for clarity.
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@fb.com>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 8b28499a
...@@ -237,6 +237,38 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info, ...@@ -237,6 +237,38 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
} }
EXPORT_SYMBOL(smp_call_function_single); EXPORT_SYMBOL(smp_call_function_single);
/**
* __smp_call_function_single(): Run a function on a specific CPU
* @cpu: The CPU to run on.
* @csd: Pre-allocated and setup data structure
* @wait: If true, wait until function has completed on specified CPU.
*
* Like smp_call_function_single(), but allow caller to pass in a
* pre-allocated data structure. Useful for embedding @data inside
* other structures, for instance.
*/
int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
{
int err = 0;
int this_cpu;
this_cpu = get_cpu();
/*
* Can deadlock when called with interrupts disabled.
* We allow cpu's that are not yet online though, as no one else can
* send smp call function interrupt to this cpu and as such deadlocks
* can't happen.
*/
WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
&& !oops_in_progress);
err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
put_cpu();
return err;
}
EXPORT_SYMBOL_GPL(__smp_call_function_single);
/* /*
* smp_call_function_any - Run a function on any of the given cpus * smp_call_function_any - Run a function on any of the given cpus
* @mask: The mask of cpus it can run on. * @mask: The mask of cpus it can run on.
...@@ -280,38 +312,6 @@ int smp_call_function_any(const struct cpumask *mask, ...@@ -280,38 +312,6 @@ int smp_call_function_any(const struct cpumask *mask,
} }
EXPORT_SYMBOL_GPL(smp_call_function_any); EXPORT_SYMBOL_GPL(smp_call_function_any);
/**
* __smp_call_function_single(): Run a function on a specific CPU
* @cpu: The CPU to run on.
* @csd: Pre-allocated and setup data structure
* @wait: If true, wait until function has completed on specified CPU.
*
* Like smp_call_function_single(), but allow caller to pass in a
* pre-allocated data structure. Useful for embedding @data inside
* other structures, for instance.
*/
int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
{
int err = 0;
int this_cpu;
this_cpu = get_cpu();
/*
* Can deadlock when called with interrupts disabled.
* We allow cpu's that are not yet online though, as no one else can
* send smp call function interrupt to this cpu and as such deadlocks
* can't happen.
*/
WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
&& !oops_in_progress);
err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
put_cpu();
return err;
}
EXPORT_SYMBOL_GPL(__smp_call_function_single);
/** /**
* smp_call_function_many(): Run a function on a set of other CPUs. * smp_call_function_many(): Run a function on a set of other CPUs.
* @mask: The set of cpus to run on (only runs on online subset). * @mask: The set of cpus to run on (only runs on online subset).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment