diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-05 13:13:03 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-05 13:13:03 -0400 |
| commit | 5e66dd6d66ffe758b39b6dcadf2330753ee1159b (patch) | |
| tree | a72cdcff4448e4af9425cc213ddf56ab23e697fe /kernel/stop_machine.c | |
| parent | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (diff) | |
| parent | ca78f6baca863afe2e6a244a0fe94b3a70211d46 (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'kernel/stop_machine.c')
| -rw-r--r-- | kernel/stop_machine.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 2c0aacc37c55..dcfb5d731466 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | #include <linux/cpu.h> | 4 | #include <linux/cpu.h> |
| 5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
| 6 | #include <linux/syscalls.h> | 6 | #include <linux/syscalls.h> |
| 7 | #include <linux/kthread.h> | ||
| 8 | #include <asm/atomic.h> | 7 | #include <asm/atomic.h> |
| 9 | #include <asm/semaphore.h> | 8 | #include <asm/semaphore.h> |
| 10 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
| @@ -26,11 +25,13 @@ static unsigned int stopmachine_num_threads; | |||
| 26 | static atomic_t stopmachine_thread_ack; | 25 | static atomic_t stopmachine_thread_ack; |
| 27 | static DECLARE_MUTEX(stopmachine_mutex); | 26 | static DECLARE_MUTEX(stopmachine_mutex); |
| 28 | 27 | ||
| 29 | static int stopmachine(void *unused) | 28 | static int stopmachine(void *cpu) |
| 30 | { | 29 | { |
| 31 | int irqs_disabled = 0; | 30 | int irqs_disabled = 0; |
| 32 | int prepared = 0; | 31 | int prepared = 0; |
| 33 | 32 | ||
| 33 | set_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu)); | ||
| 34 | |||
| 34 | /* Ack: we are alive */ | 35 | /* Ack: we are alive */ |
| 35 | smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */ | 36 | smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */ |
| 36 | atomic_inc(&stopmachine_thread_ack); | 37 | atomic_inc(&stopmachine_thread_ack); |
| @@ -84,8 +85,7 @@ static void stopmachine_set_state(enum stopmachine_state state) | |||
| 84 | 85 | ||
| 85 | static int stop_machine(void) | 86 | static int stop_machine(void) |
| 86 | { | 87 | { |
| 87 | int ret = 0; | 88 | int i, ret = 0; |
| 88 | unsigned int i; | ||
| 89 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | 89 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; |
| 90 | 90 | ||
| 91 | /* One high-prio thread per cpu. We'll do this one. */ | 91 | /* One high-prio thread per cpu. We'll do this one. */ |
| @@ -96,16 +96,11 @@ static int stop_machine(void) | |||
| 96 | stopmachine_state = STOPMACHINE_WAIT; | 96 | stopmachine_state = STOPMACHINE_WAIT; |
| 97 | 97 | ||
| 98 | for_each_online_cpu(i) { | 98 | for_each_online_cpu(i) { |
| 99 | struct task_struct *tsk; | ||
| 100 | if (i == raw_smp_processor_id()) | 99 | if (i == raw_smp_processor_id()) |
| 101 | continue; | 100 | continue; |
| 102 | tsk = kthread_create(stopmachine, NULL, "stopmachine"); | 101 | ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL); |
| 103 | if (IS_ERR(tsk)) { | 102 | if (ret < 0) |
| 104 | ret = PTR_ERR(tsk); | ||
| 105 | break; | 103 | break; |
| 106 | } | ||
| 107 | kthread_bind(tsk, i); | ||
| 108 | wake_up_process(tsk); | ||
| 109 | stopmachine_num_threads++; | 104 | stopmachine_num_threads++; |
| 110 | } | 105 | } |
| 111 | 106 | ||
