From 330647a9501fe8f93a8ae9361417e51ee0bebd7e Mon Sep 17 00:00:00 2001 From: Tuukka Tikkanen Date: Wed, 14 Aug 2013 19:02:34 +0300 Subject: [PATCH] cpuidle: Ignore interval prediction result when timer is shorter This patch prevents cpuidle menu governor from using repeating interval prediction result if the idle period predicted is longer than the one allowed by shortest running timer. Signed-off-by: Tuukka Tikkanen Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cbbb73b..3516973 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -238,10 +238,13 @@ again: * * The typical interval is obtained when standard deviation is small * or standard deviation is small compared to the average interval. + * + * Use this result only if there is no timer to wake us up sooner. */ if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) || stddev <= 20) { - data->predicted_us = avg; + if (data->expected_us > avg) + data->predicted_us = avg; return; } else if ((divisor * 4) > INTERVALS * 3) { -- 2.7.4