summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSaravana Kannan <skannan@codeaurora.org>2015-09-02 16:21:15 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:04:37 -0700
commite006885fd248d821e54aaa8d41080361e36ca087 (patch)
tree08d7eea9f1053cd7e9b62c93dd3a0c8676184d75 /drivers
parentf82a7ca96a96a8dddcc28a21a4f9d9c9127eaa6b (diff)
PM / devfreq: bw_hwmon: Fix handling of max_mbps
When doing over-voting due to an UP_WAKE event, the governor pre-initialized the max_mbps value for the next decision window. This was done to prevent a dropping the vote below the original measurement in case a DOWN_WAKE event comes before the decision window is complete. This has the undesirable side-effect of keeping the votes high for two decision windows following an UP_WAKE event. Also, DOWN_WAKE event is currently disabled for any decision windows that didn't do over-voting because doing so had significant performance impacts. However, with historic max tracking, pattern detection and hysteresis, and mbps zones awareness that were added later on, the above concerns aren't really valid anymore. So, simply delete the pre-initialization of the max_mbps so that one decision window isn't unnecessarily voting higher than necessary. As part of the change, also fix down_cnt logic to allow it to work for all decision windows if enabled. Change-Id: I600e3783da617ed4efef5b05156016d88c301cea Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/devfreq/governor_bw_hwmon.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/devfreq/governor_bw_hwmon.c b/drivers/devfreq/governor_bw_hwmon.c
index f07011772c46..b369fed1a821 100644
--- a/drivers/devfreq/governor_bw_hwmon.c
+++ b/drivers/devfreq/governor_bw_hwmon.c
@@ -220,10 +220,11 @@ static int __bw_hwmon_sample_end(struct bw_hwmon *hwmon)
* bandwidth usage and do the bandwidth calculation based on just
* this micro sample.
*/
- if (mbps > node->up_wake_mbps)
+ if (mbps > node->up_wake_mbps) {
wake = UP_WAKE;
- else if (mbps < node->down_wake_mbps) {
- node->down_cnt--;
+ } else if (mbps < node->down_wake_mbps) {
+ if (node->down_cnt)
+ node->down_cnt--;
if (node->down_cnt <= 0)
wake = DOWN_WAKE;
}
@@ -338,15 +339,6 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
req_mbps += ((meas_mbps - node->prev_req)
* node->up_scale) / 100;
/*
- * Don't drop below max_mbps which caused the UP_WAKE if
- * down_thres is enabled. This is functionally equivalent of
- * two adjacent decision windows overlapping by one short
- * sample window when an UP_WAKE happens.
- */
- node->max_mbps = meas_mbps;
- node->down_cnt = node->down_count;
-
- /*
* However if the measured load is less than the historic
* peak, but the over request is higher than the historic
* peak, then we could limit the over requesting to the
@@ -357,13 +349,6 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
req_mbps = node->hist_max_mbps;
req_mbps = min(req_mbps, meas_mbps_zone);
- } else {
- /*
- * We want to quickly drop the vote only if we are
- * over-voting (UP_WAKE). So, effectively disable it for all
- * other cases by setting it to a very large value.
- */
- node->down_cnt = INT_MAX;
}
hyst_lo_tol = (node->hyst_mbps * HIST_PEAK_TOL) / 100;
@@ -420,6 +405,7 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
node->down_wake_mbps = (meas_mbps * node->down_thres) / 100;
thres = mbps_to_bytes(meas_mbps, node->sample_ms);
}
+ node->down_cnt = node->down_count;
node->bytes = hw->set_thres(hw, thres);