diff options
author | Yong Zhang <yong.zhang0@gmail.com> | 2011-07-28 11:16:00 +0800 |
---|---|---|
committer | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-02-13 00:34:58 +0100 |
commit | 03f3039d78c331d9f4e99f11eddeb61661b5f668 (patch) | |
tree | 2db468975394c3534ff1cff0c4b720d91ef50aa4 | |
parent | d53fa489f55e334afb9847a32b3e6b83ec9b810d (diff) | |
download | rt-linux-03f3039d78c331d9f4e99f11eddeb61661b5f668.tar.gz |
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>
-rw-r--r-- | kernel/cpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 5821286b8bd6e..553a75518b3fb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -107,9 +107,11 @@ static DEFINE_PER_CPU(struct hotplug_pcp, hotplug_pcp); */ void pin_current_cpu(void) { - struct hotplug_pcp *hp = this_cpu_ptr(&hotplug_pcp); + struct hotplug_pcp *hp; retry: + hp = this_cpu_ptr(&hotplug_pcp); + if (!hp->unplug || hp->refcount || preempt_count() > 1 || hp->unplug == current) { hp->refcount++; |