[PATCH] cpuidle: coupled: Fix the alive_count based on CPU online/offline.

From: Santosh Shilimkar
Date: Sat Mar 17 2012 - 08:16:50 EST


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 <santosh.shilimkar@xxxxxx>
---
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


--------------010003030608010006070203--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/