summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorYong Zhang <yong.zhang0@gmail.com>2011-07-28 11:16:00 +0800
committerClark Williams <williams@redhat.com>2012-02-15 10:32:49 -0600
commit103215078a333a3d51bf46d1396f62f5d3affbce (patch)
treee665963ba3d267cc57ddbda5e3b36d4f55904135 /kernel
parent11c56cbe5ed371dd9a3e8f45a27b4d5ae3fd8d96 (diff)
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')
-rw-r--r--kernel/cpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 171cb6ce29c7..80c72da6af95 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -76,9 +76,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 || (current->flags & PF_STOMPER)) {
hp->refcount++;