From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>, Tejun Heo <tj@kernel.org>
Cc: paulmck@linux.vnet.ibm.com, mingo@redhat.com, der.herr@hofr.at,
dave@stgolabs.net, riel@redhat.com, viro@ZenIV.linux.org.uk,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] stop_machine: don't do for_each_cpu() twice in queue_stop_cpus_work()
Date: Tue, 30 Jun 2015 03:29:48 +0200 [thread overview]
Message-ID: <20150630012948.GA23927@redhat.com> (raw)
In-Reply-To: <20150630012931.GA23904@redhat.com>
queue_stop_cpus_work() can do everything in one for_each_cpu() loop.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/stop_machine.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 6e677b0..6212208 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -303,22 +303,19 @@ static void queue_stop_cpus_work(const struct cpumask *cpumask,
struct cpu_stop_work *work;
unsigned int cpu;
- /* initialize works and done */
- for_each_cpu(cpu, cpumask) {
- work = &per_cpu(cpu_stopper.stop_work, cpu);
- work->fn = fn;
- work->arg = arg;
- work->done = done;
- }
-
/*
* Disable preemption while queueing to avoid getting
* preempted by a stopper which might wait for other stoppers
* to enter @fn which can lead to deadlock.
*/
lg_global_lock(&stop_cpus_lock);
- for_each_cpu(cpu, cpumask)
- cpu_stop_queue_work(cpu, &per_cpu(cpu_stopper.stop_work, cpu));
+ for_each_cpu(cpu, cpumask) {
+ work = &per_cpu(cpu_stopper.stop_work, cpu);
+ work->fn = fn;
+ work->arg = arg;
+ work->done = done;
+ cpu_stop_queue_work(cpu, work);
+ }
lg_global_unlock(&stop_cpus_lock);
}
--
1.5.5.1
next prev parent reply other threads:[~2015-06-30 1:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 1:29 [PATCH 0/5] stop_machine: cleanups and fix Oleg Nesterov
2015-06-30 1:29 ` [PATCH 1/5] stop_machine: move cpu_stopper_task and stop_cpus_work into struct cpu_stopper Oleg Nesterov
2015-08-03 17:08 ` [tip:sched/core] stop_machine: Move 'cpu_stopper_task' and ' stop_cpus_work' into 'struct cpu_stopper' tip-bot for Oleg Nesterov
2015-06-30 1:29 ` Oleg Nesterov [this message]
2015-08-03 17:09 ` [tip:sched/core] stop_machine: Don't do for_each_cpu() twice in queue_stop_cpus_work() tip-bot for Oleg Nesterov
2015-06-30 1:29 ` [PATCH 3/5] stop_machine: unexport __stop_machine() Oleg Nesterov
2015-08-03 17:09 ` [tip:sched/core] stop_machine: Unexport __stop_machine() tip-bot for Oleg Nesterov
2015-06-30 1:29 ` [PATCH 4/5] stop_machine: use cpu_stop_fn_t where possible Oleg Nesterov
2015-06-30 14:28 ` Peter Zijlstra
2015-08-03 17:09 ` [tip:sched/core] stop_machine: Use 'cpu_stop_fn_t' " tip-bot for Oleg Nesterov
2015-06-30 1:29 ` [PATCH 5/5] stop_machine: cpu_stop_park() should remove cpu_stop_work's from list Oleg Nesterov
2015-08-03 17:10 ` [tip:sched/core] stop_machine: Remove cpu_stop_work' s from list in cpu_stop_park() tip-bot for Oleg Nesterov
2015-06-30 12:52 ` [PATCH 0/5] stop_machine: cleanups and fix Oleg Nesterov
2015-07-01 19:22 ` Oleg Nesterov
2015-07-01 19:23 ` [PATCH 6/5] stop_machine: kill stop_cpus_lock and lg_double_lock/unlock() Oleg Nesterov
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=20150630012948.GA23927@redhat.com \
--to=oleg@redhat.com \
--cc=dave@stgolabs.net \
--cc=der.herr@hofr.at \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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