From: Max Krasnyansky <maxk@qualcomm.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
Max Krasnyansky <maxk@qualcomm.com>,
dmitry.adamushko@gmail.com, a.p.zijlstra@chello.nl,
rostedt@goodmis.org, vegard.nossum@gmail.com
Subject: [PATCH] cpu hotplug: Make cpu_active_map synchronization dependency clear
Date: Tue, 15 Jul 2008 20:56:26 -0700 [thread overview]
Message-ID: <1216180586-8313-1-git-send-email-maxk@qualcomm.com> (raw)
This goes on top of the cpu_active_map (take 2) patch.
Currently we depend on the stop_machine to provide nescessesary
synchronization for the cpu_active_map updates.
As Dmitry Adamushko pointed this is fragile and is not much clearer
than the previous scheme. In other words we do not want to depend on
the internal stop machine operation here.
So make the synchronization rules clear by doing synchronize_sched()
after clearing out cpu active bit.
Tested on quad-Core2 with:
while true; do
for i in 1 2 3; do
echo 0 > /sys/devices/system/cpu/cpu$i/online
done
for i in 1 2 3; do
echo 1 > /sys/devices/system/cpu/cpu$i/online
done
done
and
stress -c 200
No lockdep, preempt or other complaints.
Signed-off-by: Max Krasnyansky <maxk@qualcomm.com>
Cc: dmitry.adamushko@gmail.com
Cc: a.p.zijlstra@chello.nl
Cc: mingo@elte.hu
Cc: rostedt@goodmis.org
Cc: vegard.nossum@gmail.com
---
kernel/cpu.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 71c5c9d..541f78e 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -301,6 +301,14 @@ int __ref cpu_down(unsigned int cpu)
cpu_clear(cpu, cpu_active_map);
+ /* Make sure the all cpus did the reschedule and are not
+ * using stale version of the cpu_active_map.
+ * This is not strictly necessary becuase stop_machine()
+ * that we run down the line already provides the required
+ * synchronization. But it's really a side effect and we do not
+ * want to depend on the innards of the stop_machine here. */
+ synchronize_sched();
+
err = _cpu_down(cpu, 0);
if (cpu_online(cpu))
--
1.5.5.1
next reply other threads:[~2008-07-16 3:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 3:56 Max Krasnyansky [this message]
2008-07-18 11:26 ` [PATCH] cpu hotplug: Make cpu_active_map synchronization dependency clear Ingo Molnar
2008-07-18 12:03 ` Ingo Molnar
2008-07-22 4:07 ` Max Krasnyansky
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=1216180586-8313-1-git-send-email-maxk@qualcomm.com \
--to=maxk@qualcomm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=dmitry.adamushko@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=vegard.nossum@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.