summaryrefslogtreecommitdiff
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorYong Zhang <yong.zhang0@gmail.com>2011-07-28 03:16:00 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-10 00:19:14 (GMT)
commitf31b617a9cfe6498b9ebc27187fee5385c17e337 (patch)
tree5ce7cdba60adbd10cc4782f97b8d4e49a0f1d344 /kernel/cpu.c
parent24ff554021113fcf827e3aac0bca57956fb169a3 (diff)
downloadlinux-fsl-qoriq-f31b617a9cfe6498b9ebc27187fee5385c17e337.tar.xz
hotplug: Reread hotplug_pcp on pin_current_cpu() retry
When retry happens, it's likely that the task has been migrated to another cpu (except unplug failed), but it still derefernces the original hotplug_pcp per cpu data. Update the pointer to hotplug_pcp in the retry path, so it points to the current cpu. Signed-off-by: Yong Zhang <yong.zhang0@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110728031600.GA338@windriver.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 7de9868..b9c39b5 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -81,9 +81,11 @@ static DEFINE_PER_CPU(struct hotplug_pcp, hotplug_pcp);
*/
void pin_current_cpu(void)
{
- struct hotplug_pcp *hp = &__get_cpu_var(hotplug_pcp);
+ struct hotplug_pcp *hp;
retry:
+ hp = &__get_cpu_var(hotplug_pcp);
+
if (!hp->unplug || hp->refcount || preempt_count() > 1 ||
hp->unplug == current) {
hp->refcount++;