>From 189e5862ea4f983313cbf6abb7aabab670267c83 Mon Sep 17 00:00:00 2001 From: Santosh Shilimkar Date: Sat, 17 Mar 2012 17:46:50 +0530 Subject: [PATCH] cpuidle: coupled: Fix the alive_count based on CPU online/offline. Currently the alive_count is ever incrementing which will lead to coupled idle state not being attempted after one CPU offline attempt. Signed-off-by: Santosh Shilimkar --- drivers/cpuidle/coupled.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c index 3bc8a02..708bcfe 100644 --- a/drivers/cpuidle/coupled.c +++ b/drivers/cpuidle/coupled.c @@ -595,14 +595,18 @@ static void cpuidle_coupled_cpu_set_alive(int cpu, bool alive) while (atomic_read(&coupled->ready_count)) cpu_relax(); - smp_mb__before_atomic_inc(); - atomic_inc(&coupled->alive_count); - smp_mb__after_atomic_inc(); - if (alive) + if (alive) { + smp_mb__before_atomic_inc(); + atomic_inc(&coupled->alive_count); + smp_mb__after_atomic_inc(); coupled->requested_state[dev->cpu] = CPUIDLE_COUPLED_NOT_IDLE; - else + } else { + smp_mb__before_atomic_inc(); + atomic_dec(&coupled->alive_count); + smp_mb__after_atomic_inc(); coupled->requested_state[dev->cpu] = CPUIDLE_COUPLED_DEAD; + } out: mutex_unlock(&cpuidle_lock); -- 1.7.4.1