aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2015-11-15 14:33:26 -0500
committerIngo Molnar <mingo@kernel.org>2015-11-23 03:48:19 -0500
commit6fa3b826bcb3309157166e6e523a4be236fe267a (patch)
tree71dc4049f7d2e215314f0eebc41194976ae125e6
parent4aff1ca6970afbf9cd916c34a9c442c8ccba905e (diff)
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: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Tejun 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.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/stop_machine.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index ed2019ac192d..09eb83fc9f0e 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -28,7 +28,6 @@
28 */ 28 */
29struct cpu_stop_done { 29struct cpu_stop_done {
30 atomic_t nr_todo; /* nr left to execute */ 30 atomic_t nr_todo; /* nr left to execute */
31 bool executed; /* actually executed? */
32 int ret; /* collected return value */ 31 int ret; /* collected return value */
33 struct completion completion; /* fired if nr_todo reaches 0 */ 32 struct completion completion; /* fired if nr_todo reaches 0 */
34}; 33};
@@ -63,11 +62,9 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
63} 62}
64 63
65/* signal completion unless @done is NULL */ 64/* signal completion unless @done is NULL */
66static void cpu_stop_signal_done(struct cpu_stop_done *done, bool executed) 65static void cpu_stop_signal_done(struct cpu_stop_done *done)
67{ 66{
68 if (done) { 67 if (done) {
69 if (executed)
70 done->executed = true;
71 if (atomic_dec_and_test(&done->nr_todo)) 68 if (atomic_dec_and_test(&done->nr_todo))
72 complete(&done->completion); 69 complete(&done->completion);
73 } 70 }
@@ -92,7 +89,7 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work)
92 if (enabled) 89 if (enabled)
93 __cpu_stop_queue_work(stopper, work); 90 __cpu_stop_queue_work(stopper, work);
94 else 91 else
95 cpu_stop_signal_done(work->done, false); 92 cpu_stop_signal_done(work->done);
96 spin_unlock_irqrestore(&stopper->lock, flags); 93 spin_unlock_irqrestore(&stopper->lock, flags);
97 94
98 return enabled; 95 return enabled;
@@ -131,7 +128,6 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
131 if (!cpu_stop_queue_work(cpu, &work)) 128 if (!cpu_stop_queue_work(cpu, &work))
132 return -ENOENT; 129 return -ENOENT;
133 wait_for_completion(&done.completion); 130 wait_for_completion(&done.completion);
134 WARN_ON(!done.executed);
135 return done.ret; 131 return done.ret;
136} 132}
137 133
@@ -286,7 +282,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
286 return -ENOENT; 282 return -ENOENT;
287 283
288 wait_for_completion(&done.completion); 284 wait_for_completion(&done.completion);
289 WARN_ON(!done.executed);
290 return done.ret; 285 return done.ret;
291} 286}
292 287
@@ -354,7 +349,6 @@ static int __stop_cpus(const struct cpumask *cpumask,
354 if (!queue_stop_cpus_work(cpumask, fn, arg, &done)) 349 if (!queue_stop_cpus_work(cpumask, fn, arg, &done))
355 return -ENOENT; 350 return -ENOENT;
356 wait_for_completion(&done.completion); 351 wait_for_completion(&done.completion);
357 WARN_ON(!done.executed);
358 return done.ret; 352 return done.ret;
359} 353}
360 354
@@ -467,6 +461,7 @@ repeat:
467 ret = fn(arg); 461 ret = fn(arg);
468 if (ret && done) 462 if (ret && done)
469 done->ret = ret; 463 done->ret = ret;
464 cpu_stop_signal_done(done);
470 465
471 /* restore preemption and check it's still balanced */ 466 /* restore preemption and check it's still balanced */
472 preempt_enable(); 467 preempt_enable();
@@ -475,7 +470,6 @@ repeat:
475 kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL, 470 kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL,
476 ksym_buf), arg); 471 ksym_buf), arg);
477 472
478 cpu_stop_signal_done(done, true);
479 goto repeat; 473 goto repeat;
480 } 474 }
481} 475}