Commit 157317ba authored by Zhao Yakui's avatar Zhao Yakui Committed by Len Brown

ACPI: Fix the incorrect calculation about C-state idle time

The C-state idle time is not calculated correctly, which will return the wrong
residency time in C-state. It will have the following effects:
   1.  The system can't choose the deeper C-state when it is idle next time.
Of course the system power is increased. E.g. On one server machine about 40W
idle power is increased.
   2.  The powertop shows that it will stay in C0 running state about 95% time
although the system is idle at most time.

2.6.35-rc1 regression caused-by: 2da513f5
(ACPI: Minor cleanup eliminating redundant PMTIMER_TICKS to NS conversion)
Signed-off-by: default avatarZhao Yakui <yakui.zhao@intel.com>
Reported-by: default avatarYu Zhidong <zhidong.yu@intel.com>
Tested-by: default avatarYu Zhidong <zhidong.yu@intel.com>
Acked-by: default avatarVenkatesh Pallipadi <venki@google.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 67a3e12b
...@@ -1022,7 +1022,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ...@@ -1022,7 +1022,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
spin_unlock(&c3_lock); spin_unlock(&c3_lock);
} }
kt2 = ktime_get_real(); kt2 = ktime_get_real();
idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1)); idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
idle_time = idle_time_ns; idle_time = idle_time_ns;
do_div(idle_time, NSEC_PER_USEC); do_div(idle_time, NSEC_PER_USEC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment