From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>
Cc: Milos Vyletel <milos@redhat.com>,
Prarit Bhargava <prarit@redhat.com>, Tejun Heo <tj@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] stop_machine: kill cpu_stop_done->executed
Date: Sun, 15 Nov 2015 20:33:26 +0100 [thread overview]
Message-ID: <20151115193326.GA8269@redhat.com> (raw)
In-Reply-To: <20151115193254.GA8225@redhat.com>
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>
---
kernel/stop_machine.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index ed2019a..09eb83f 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -28,7 +28,6 @@
*/
struct cpu_stop_done {
atomic_t nr_todo; /* nr left to execute */
- bool executed; /* actually executed? */
int ret; /* collected return value */
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)
}
/* 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 (executed)
- done->executed = true;
if (atomic_dec_and_test(&done->nr_todo))
complete(&done->completion);
}
@@ -92,7 +89,7 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work)
if (enabled)
__cpu_stop_queue_work(stopper, work);
else
- cpu_stop_signal_done(work->done, false);
+ cpu_stop_signal_done(work->done);
spin_unlock_irqrestore(&stopper->lock, flags);
return enabled;
@@ -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))
return -ENOENT;
wait_for_completion(&done.completion);
- WARN_ON(!done.executed);
return done.ret;
}
@@ -286,7 +282,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
return -ENOENT;
wait_for_completion(&done.completion);
- WARN_ON(!done.executed);
return done.ret;
}
@@ -354,7 +349,6 @@ static int __stop_cpus(const struct cpumask *cpumask,
if (!queue_stop_cpus_work(cpumask, fn, arg, &done))
return -ENOENT;
wait_for_completion(&done.completion);
- WARN_ON(!done.executed);
return done.ret;
}
@@ -467,6 +461,7 @@ repeat:
ret = fn(arg);
if (ret && done)
done->ret = ret;
+ cpu_stop_signal_done(done);
/* restore preemption and check it's still balanced */
preempt_enable();
@@ -475,7 +470,6 @@ repeat:
kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL,
ksym_buf), arg);
- cpu_stop_signal_done(done, true);
goto repeat;
}
}
--
1.5.5.1
next prev parent reply other threads:[~2015-11-15 18:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-15 19:32 [PATCH 0/8] stop_machine: stop_one_cpu_nowait() fix, misc cleanups Oleg Nesterov
2015-11-15 19:33 ` [PATCH 1/8] stop_machine: cpu_stopper_thread() must check done != NULL Oleg Nesterov
2015-11-16 18:52 ` Tejun Heo
2015-11-17 17:53 ` Oleg Nesterov
2015-11-23 16:21 ` [tip:sched/core] stop_machine: Fix possible cpu_stopper_thread() crash tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 2/8] stop_machine: don't disable preemption in stop_two_cpus() Oleg Nesterov
2015-11-23 16:21 ` [tip:sched/core] stop_machine: Don' t " tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 3/8] stop_machine: make cpu_stop_queue_work() and stop_one_cpu_nowait() return bool Oleg Nesterov
2015-11-17 17:05 ` [PATCH v2 " Oleg Nesterov
2015-11-17 18:05 ` Peter Zijlstra
2015-11-23 16:22 ` [tip:sched/core] stop_machine: Make " tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 4/8] stop_machine: change stop_one_cpu() to rely on cpu_stop_queue_work() Oleg Nesterov
2015-11-23 16:22 ` [tip:sched/core] stop_machine: Change " tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 5/8] stop_machine: change __stop_cpus() " Oleg Nesterov
2015-11-23 16:22 ` [tip:sched/core] stop_machine: Change " tip-bot for Oleg Nesterov
2015-11-15 19:33 ` Oleg Nesterov [this message]
2015-11-23 16:23 ` [tip:sched/core] stop_machine: Kill cpu_stop_done->executed tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 7/8] stop_machine: shift the done != NULL check from cpu_stop_signal_done() to callers Oleg Nesterov
2015-11-23 16:23 ` [tip:sched/core] stop_machine: Shift the 'done != NULL' " tip-bot for Oleg Nesterov
2015-11-15 19:33 ` [PATCH 8/8] stop_machine: cleanup the usage of preemption counter in cpu_stopper_thread() Oleg Nesterov
2015-11-16 19:10 ` Tejun Heo
2015-11-23 16:23 ` [tip:sched/core] stop_machine: Clean up the usage of the " tip-bot for Oleg Nesterov
2015-11-16 9:43 ` [PATCH 0/8] stop_machine: stop_one_cpu_nowait() fix, misc cleanups Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151115193326.GA8269@redhat.com \
--to=oleg@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=milos@redhat.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=prarit@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox