aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/stop_machine.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-07-28 13:16:28 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-07-27 22:16:29 -0400
commitffdb5976c47609c862917d4c186ecbb5706d2dda (patch)
tree7a8485260922290080094adc25f3cbebd4ad506b /include/linux/stop_machine.h
parent5c2aed622571ac7c3c6ec182d6d3c318e4b45c8b (diff)
Simplify stop_machine
stop_machine creates a kthread which creates kernel threads. We can create those threads directly and simplify things a little. Some care must be taken with CPU hotunplug, which has special needs, but that code seems more robust than it was in the past. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'include/linux/stop_machine.h')
-rw-r--r--include/linux/stop_machine.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 18af011c13af..36c2c7284eb3 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -17,13 +17,12 @@
17 * @data: the data ptr for the @fn() 17 * @data: the data ptr for the @fn()
18 * @cpu: if @cpu == n, run @fn() on cpu n 18 * @cpu: if @cpu == n, run @fn() on cpu n
19 * if @cpu == NR_CPUS, run @fn() on any cpu 19 * if @cpu == NR_CPUS, run @fn() on any cpu
20 * if @cpu == ALL_CPUS, run @fn() first on the calling cpu, and then 20 * if @cpu == ALL_CPUS, run @fn() on every online CPU.
21 * concurrently on all the other cpus
22 * 21 *
23 * Description: This causes a thread to be scheduled on every other cpu, 22 * Description: This causes a thread to be scheduled on every cpu,
24 * each of which disables interrupts, and finally interrupts are disabled 23 * each of which disables interrupts. The result is that noone is
25 * on the current CPU. The result is that noone is holding a spinlock 24 * holding a spinlock or inside any other preempt-disabled region when
26 * or inside any other preempt-disabled region when @fn() runs. 25 * @fn() runs.
27 * 26 *
28 * This can be thought of as a very heavy write lock, equivalent to 27 * This can be thought of as a very heavy write lock, equivalent to
29 * grabbing every spinlock in the kernel. */ 28 * grabbing every spinlock in the kernel. */
@@ -35,13 +34,10 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu);
35 * @data: the data ptr for the @fn 34 * @data: the data ptr for the @fn
36 * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. 35 * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS.
37 * 36 *
38 * Description: This is a special version of the above, which returns the 37 * Description: This is a special version of the above, which assumes cpus
39 * thread which has run @fn(): kthread_stop will return the return value 38 * won't come or go while it's being called. Used by hotplug cpu.
40 * of @fn(). Used by hotplug cpu.
41 */ 39 */
42struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, 40int __stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu);
43 unsigned int cpu);
44
45#else 41#else
46 42
47static inline int stop_machine_run(int (*fn)(void *), void *data, 43static inline int stop_machine_run(int (*fn)(void *), void *data,