From: Yong Zhang Date: Thu, 28 Jul 2011 11:16:00 +0800 Subject: 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 Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20110728031600.GA338@windriver.com Signed-off-by: Thomas Gleixner --- kernel/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-3.2/kernel/cpu.c =================================================================== --- linux-3.2.orig/kernel/cpu.c +++ linux-3.2/kernel/cpu.c @@ -76,9 +76,11 @@ static DEFINE_PER_CPU(struct 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++;