Commit 6fa3b826 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Ingo Molnar

stop_machine: Kill cpu_stop_done->executed

Now that cpu_stop_done->executed becomes write-only (ignoring WARN_ON()
checks) we can remove it.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Milos Vyletel <milos@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20151115193326.GA8269@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4aff1ca6
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
*/ */
struct cpu_stop_done { struct cpu_stop_done {
atomic_t nr_todo; /* nr left to execute */ atomic_t nr_todo; /* nr left to execute */
bool executed; /* actually executed? */
int ret; /* collected return value */ int ret; /* collected return value */
struct completion completion; /* fired if nr_todo reaches 0 */ struct completion completion; /* fired if nr_todo reaches 0 */
}; };
...@@ -63,11 +62,9 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo) ...@@ -63,11 +62,9 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
} }
/* signal completion unless @done is NULL */ /* signal completion unless @done is NULL */
static void cpu_stop_signal_done(struct cpu_stop_done *done, bool executed) static void cpu_stop_signal_done(struct cpu_stop_done *done)
{ {
if (done) { if (done) {
if (executed)
done->executed = true;
if (atomic_dec_and_test(&done->nr_todo)) if (atomic_dec_and_test(&done->nr_todo))
complete(&done->completion); complete(&done->completion);
} }
...@@ -92,7 +89,7 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) ...@@ -92,7 +89,7 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work)
if (enabled) if (enabled)
__cpu_stop_queue_work(stopper, work); __cpu_stop_queue_work(stopper, work);
else else
cpu_stop_signal_done(work->done, false); cpu_stop_signal_done(work->done);
spin_unlock_irqrestore(&stopper->lock, flags); spin_unlock_irqrestore(&stopper->lock, flags);
return enabled; return enabled;
...@@ -131,7 +128,6 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg) ...@@ -131,7 +128,6 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
if (!cpu_stop_queue_work(cpu, &work)) if (!cpu_stop_queue_work(cpu, &work))
return -ENOENT; return -ENOENT;
wait_for_completion(&done.completion); wait_for_completion(&done.completion);
WARN_ON(!done.executed);
return done.ret; return done.ret;
} }
...@@ -286,7 +282,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * ...@@ -286,7 +282,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
return -ENOENT; return -ENOENT;
wait_for_completion(&done.completion); wait_for_completion(&done.completion);
WARN_ON(!done.executed);
return done.ret; return done.ret;
} }
...@@ -354,7 +349,6 @@ static int __stop_cpus(const struct cpumask *cpumask, ...@@ -354,7 +349,6 @@ static int __stop_cpus(const struct cpumask *cpumask,
if (!queue_stop_cpus_work(cpumask, fn, arg, &done)) if (!queue_stop_cpus_work(cpumask, fn, arg, &done))
return -ENOENT; return -ENOENT;
wait_for_completion(&done.completion); wait_for_completion(&done.completion);
WARN_ON(!done.executed);
return done.ret; return done.ret;
} }
...@@ -467,6 +461,7 @@ static void cpu_stopper_thread(unsigned int cpu) ...@@ -467,6 +461,7 @@ static void cpu_stopper_thread(unsigned int cpu)
ret = fn(arg); ret = fn(arg);
if (ret && done) if (ret && done)
done->ret = ret; done->ret = ret;
cpu_stop_signal_done(done);
/* restore preemption and check it's still balanced */ /* restore preemption and check it's still balanced */
preempt_enable(); preempt_enable();
...@@ -475,7 +470,6 @@ static void cpu_stopper_thread(unsigned int cpu) ...@@ -475,7 +470,6 @@ static void cpu_stopper_thread(unsigned int cpu)
kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL, kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL,
ksym_buf), arg); ksym_buf), arg);
cpu_stop_signal_done(done, true);
goto repeat; goto repeat;
} }
} }
......
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