aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2013-08-14 12:02:35 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-22 18:24:15 -0400
commit017099e25fb7e482a249d36a654556d32f601f71 (patch)
tree95b96aff280b3e55cbd8b93e445925d25974366b /drivers/cpuidle
parent330647a9501fe8f93a8ae9361417e51ee0bebd7e (diff)
cpuidle: Rearrange code and comments in get_typical_interval()
This patch rearranges a if-return-elsif-goto-fi-return sequence into if-return-fi-if-return-fi-goto sequence. The functionality remains the same. Also, a lengthy comment that did not describe the functionality in the order it occurs is split into half and top half is moved closer to actual implementation it describes. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/governors/menu.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 351697305fe7..f1fadbecfa1b 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -228,14 +228,6 @@ again:
228 do_div(stddev, divisor); 228 do_div(stddev, divisor);
229 stddev = int_sqrt(stddev); 229 stddev = int_sqrt(stddev);
230 /* 230 /*
231 * If we have outliers to the upside in our distribution, discard
232 * those by setting the threshold to exclude these outliers, then
233 * calculate the average and standard deviation again. Once we get
234 * down to the bottom 3/4 of our samples, stop excluding samples.
235 *
236 * This can deal with workloads that have long pauses interspersed
237 * with sporadic activity with a bunch of short pauses.
238 *
239 * The typical interval is obtained when standard deviation is small 231 * The typical interval is obtained when standard deviation is small
240 * or standard deviation is small compared to the average interval. 232 * or standard deviation is small compared to the average interval.
241 * 233 *
@@ -246,12 +238,22 @@ again:
246 if (data->expected_us > avg) 238 if (data->expected_us > avg)
247 data->predicted_us = avg; 239 data->predicted_us = avg;
248 return; 240 return;
249
250 } else if ((divisor * 4) > INTERVALS * 3) {
251 /* Exclude the max interval */
252 thresh = max - 1;
253 goto again;
254 } 241 }
242
243 /*
244 * If we have outliers to the upside in our distribution, discard
245 * those by setting the threshold to exclude these outliers, then
246 * calculate the average and standard deviation again. Once we get
247 * down to the bottom 3/4 of our samples, stop excluding samples.
248 *
249 * This can deal with workloads that have long pauses interspersed
250 * with sporadic activity with a bunch of short pauses.
251 */
252 if ((divisor * 4) <= INTERVALS * 3)
253 return;
254
255 thresh = max - 1;
256 goto again;
255} 257}
256 258
257/** 259/**