aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/smp.c')
-rw-r--r--arch/x86/kernel/smp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 65dd44e3fc1c..1bb79526c217 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -148,15 +148,16 @@ static int register_stop_handler(void)
static void native_stop_other_cpus(int wait)
{
- unsigned int this_cpu;
+ unsigned int old_cpu, this_cpu;
unsigned long flags, timeout;
if (reboot_force)
return;
/* Only proceed if this is the first CPU to reach this code */
+ old_cpu = -1;
this_cpu = smp_processor_id();
- if (atomic_cmpxchg(&stopping_cpu, -1, this_cpu) != -1)
+ if (!atomic_try_cmpxchg(&stopping_cpu, &old_cpu, this_cpu))
return;
/* For kexec, ensure that offline CPUs are out of MWAIT and in HLT */