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>
This commit is contained in:
Saravana Kannan 2015-09-02 16:21:15 -07:00 committed by David Keitel
parent f82a7ca96a
commit e006885fd2

View file

@ -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;
}
@ -337,15 +338,6 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
if (node->wake == UP_WAKE) {
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
@ -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);