diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2014-02-24 10:39:59 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-02-24 17:47:01 -0500 |
commit | d7877c03f1b62de06f9c00417952f39f56c1ab00 (patch) | |
tree | 0f3e9bacdf56eaa5b104bfb03455e8e7c34e9453 /kernel/smp.c | |
parent | 8b28499a71d3431c9128abc743e2d2bfbdae3ed4 (diff) |
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: Jan 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: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'kernel/smp.c')
-rw-r--r-- | kernel/smp.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/kernel/smp.c b/kernel/smp.c index 64bb0d48e96f..fa04ab938e52 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -237,6 +237,38 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info, | |||
237 | } | 237 | } |
238 | EXPORT_SYMBOL(smp_call_function_single); | 238 | EXPORT_SYMBOL(smp_call_function_single); |
239 | 239 | ||
240 | /** | ||
241 | * __smp_call_function_single(): Run a function on a specific CPU | ||
242 | * @cpu: The CPU to run on. | ||
243 | * @csd: Pre-allocated and setup data structure | ||
244 | * @wait: If true, wait until function has completed on specified CPU. | ||
245 | * | ||
246 | * Like smp_call_function_single(), but allow caller to pass in a | ||
247 | * pre-allocated data structure. Useful for embedding @data inside | ||
248 | * other structures, for instance. | ||
249 | */ | ||
250 | int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait) | ||
251 | { | ||
252 | int err = 0; | ||
253 | int this_cpu; | ||
254 | |||
255 | this_cpu = get_cpu(); | ||
256 | /* | ||
257 | * Can deadlock when called with interrupts disabled. | ||
258 | * We allow cpu's that are not yet online though, as no one else can | ||
259 | * send smp call function interrupt to this cpu and as such deadlocks | ||
260 | * can't happen. | ||
261 | */ | ||
262 | WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled() | ||
263 | && !oops_in_progress); | ||
264 | |||
265 | err = generic_exec_single(cpu, csd, csd->func, csd->info, wait); | ||
266 | put_cpu(); | ||
267 | |||
268 | return err; | ||
269 | } | ||
270 | EXPORT_SYMBOL_GPL(__smp_call_function_single); | ||
271 | |||
240 | /* | 272 | /* |
241 | * smp_call_function_any - Run a function on any of the given cpus | 273 | * smp_call_function_any - Run a function on any of the given cpus |
242 | * @mask: The mask of cpus it can run on. | 274 | * @mask: The mask of cpus it can run on. |
@@ -281,38 +313,6 @@ call: | |||
281 | EXPORT_SYMBOL_GPL(smp_call_function_any); | 313 | EXPORT_SYMBOL_GPL(smp_call_function_any); |
282 | 314 | ||
283 | /** | 315 | /** |
284 | * __smp_call_function_single(): Run a function on a specific CPU | ||
285 | * @cpu: The CPU to run on. | ||
286 | * @csd: Pre-allocated and setup data structure | ||
287 | * @wait: If true, wait until function has completed on specified CPU. | ||
288 | * | ||
289 | * Like smp_call_function_single(), but allow caller to pass in a | ||
290 | * pre-allocated data structure. Useful for embedding @data inside | ||
291 | * other structures, for instance. | ||
292 | */ | ||
293 | int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait) | ||
294 | { | ||
295 | int err = 0; | ||
296 | int this_cpu; | ||
297 | |||
298 | this_cpu = get_cpu(); | ||
299 | /* | ||
300 | * Can deadlock when called with interrupts disabled. | ||
301 | * We allow cpu's that are not yet online though, as no one else can | ||
302 | * send smp call function interrupt to this cpu and as such deadlocks | ||
303 | * can't happen. | ||
304 | */ | ||
305 | WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled() | ||
306 | && !oops_in_progress); | ||
307 | |||
308 | err = generic_exec_single(cpu, csd, csd->func, csd->info, wait); | ||
309 | put_cpu(); | ||
310 | |||
311 | return err; | ||
312 | } | ||
313 | EXPORT_SYMBOL_GPL(__smp_call_function_single); | ||
314 | |||
315 | /** | ||
316 | * smp_call_function_many(): Run a function on a set of other CPUs. | 316 | * smp_call_function_many(): Run a function on a set of other CPUs. |
317 | * @mask: The set of cpus to run on (only runs on online subset). | 317 | * @mask: The set of cpus to run on (only runs on online subset). |
318 | * @func: The function to run. This must be fast and non-blocking. | 318 | * @func: The function to run. This must be fast and non-blocking. |