summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>2012-02-02 14:04:10 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 10:59:29 +0200
commite98defed1f31d801e4652aedbeddcc31cacd6435 (patch)
tree72f551a4338123f22b1cd5abe91e0e6efb6a0479
parent69b080dac001ff97b1bd5d439978885f398d7aa4 (diff)
[ANDROID]: arm: ux500: pm: fix array read overrun in usecase governor
Also get rid of iowait averaging as it is not used. ST-Ericsson Linux next: - ST-Ericsson ID: 371446 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ie2739cdc9c2b6a539aa49a4de7b627804c0746ae Reported-by: Venkata Biswanath Devarasetty <venkata.biswanath@stericsson.com> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/47587 Reviewed-by: QABUILD Reviewed-by: Venkata Biswanath DEVARASETTY <venkata.biswanath@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/pm/usecase_gov.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/arch/arm/mach-ux500/pm/usecase_gov.c b/arch/arm/mach-ux500/pm/usecase_gov.c
index 5c7fe403c2f..40be7239e39 100644
--- a/arch/arm/mach-ux500/pm/usecase_gov.c
+++ b/arch/arm/mach-ux500/pm/usecase_gov.c
@@ -49,7 +49,6 @@ struct hotplug_cpu_info {
cputime64_t prev_cpu_idle;
cputime64_t prev_cpu_io;
unsigned int load[LOAD_MONITOR];
- unsigned int io[LOAD_MONITOR];
unsigned int idx;
};
@@ -167,16 +166,15 @@ static unsigned long determine_cpu_load(void)
/* get cpu load of each cpu */
for_each_online_cpu(i) {
- unsigned int load, iowait;
+ unsigned int load;
unsigned int idle_time, iowait_time, wall_time;
- cputime64_t cur_wall_time, cur_idle_time, cur_iowait_time;
+ cputime64_t cur_wall_time, cur_idle_time;
struct hotplug_cpu_info *info;
info = &per_cpu(hotplug_info, i);
/* update both cur_idle_time and cur_wall_time */
cur_idle_time = get_cpu_idle_time_us(i, &cur_wall_time);
- cur_iowait_time = get_cpu_iowait_time_us(i, &cur_wall_time);
/* how much wall time has passed since last iteration? */
wall_time = (unsigned int) cputime64_sub(cur_wall_time,
@@ -188,27 +186,17 @@ static unsigned long determine_cpu_load(void)
info->prev_cpu_idle);
info->prev_cpu_idle = cur_idle_time;
- /* how much io wait time has passed since last iteration? */
- iowait_time = (unsigned int) cputime64_sub(cur_iowait_time,
- info->prev_cpu_io);
- info->prev_cpu_io = cur_iowait_time;
-
if (unlikely(!wall_time || wall_time < idle_time))
continue;
/* load is the percentage of time not spent in idle */
load = 100 * (wall_time - idle_time) / wall_time;
- info->load[info->idx] = load;
- hp_printk("cpu %d load %u ", i, load);
-
- /* iowait is the percentage of time not spent in io wait */
- iowait = 100 * (iowait_time) / wall_time;
- info->io[info->idx++] = load;
- hp_printk("iowait %u\n", iowait);
-
+ info->load[info->idx++] = load;
if (info->idx >= LOAD_MONITOR)
info->idx = 0;
+ hp_printk("cpu %d load %u ", i, load);
+
total_load += load;
}
@@ -217,7 +205,7 @@ static unsigned long determine_cpu_load(void)
static unsigned long determine_cpu_load_trend(void)
{
- int i, j, k;
+ int i, k;
unsigned long total_load = 0;
/* Get cpu load of each cpu */
@@ -227,8 +215,8 @@ static unsigned long determine_cpu_load_trend(void)
info = &per_cpu(hotplug_info, i);
- for (k = 0, j = info->idx; k < LOAD_MONITOR; k++, j++)
- load += info->load[j];
+ for (k = 0; k < LOAD_MONITOR; k++)
+ load += info->load[k];
load /= LOAD_MONITOR;
@@ -242,7 +230,7 @@ static unsigned long determine_cpu_load_trend(void)
static unsigned long determine_cpu_balance_trend(void)
{
- int i, j, k;
+ int i, k;
unsigned long total_load = 0;
unsigned long min_load = (unsigned long) (-1);
@@ -250,11 +238,10 @@ static unsigned long determine_cpu_balance_trend(void)
for_each_online_cpu(i) {
unsigned int load = 0;
struct hotplug_cpu_info *info;
+ info = &per_cpu(hotplug_info, i);
- info = &per_cpu(hotplug_info, i);
-
- for (k = 0, j = info->idx; k < LOAD_MONITOR; k++, j++)
- load += info->load[j];
+ for (k = 0; k < LOAD_MONITOR; k++)
+ load += info->load[k];
load /= LOAD_MONITOR;
@@ -288,7 +275,6 @@ static void init_cpu_load_trend(void)
for (j = 0; j < LOAD_MONITOR; j++) {
info->load[j] = 100;
- info->io[j] = 100;
}
info->idx = 0;
}