summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavankumar Kondeti <pkondeti@codeaurora.org>2017-06-08 15:19:48 +0530
committerPavankumar Kondeti <pkondeti@codeaurora.org>2017-06-09 06:40:02 +0530
commita761ae85013944d6e007a343c7f24c342ae4dc18 (patch)
tree301f4502e3335f97e2cc86f96cb2ab6ac2b6ad56
parent9725c4d90bee3b0be78bb1fdc084df1ec08d7d24 (diff)
sched: Fix the bug in select_best_cpu() that returns -1 as target_cpu
select_best_cpu() has previous CPU's cluster bias which overrides the best_cpu with best_sibling_cpu when the power cost is same. When the power table is configured incorrectly or static_cpu_pwr_cost/ static_cluster_pwr_cost tunables are set to a large value, the power_cost() for all candidate CPUs can return INT_MAX. So the stats.min_cost is never changed from it's initial value i.e INT_MAX. In the above scenario, we find stats.best_cpu >= 0 && stats.min_cost = stats.best_sibling_cpu_cost = INT_MAX && stats.best_sibling_cpu_cost = -1 and replace best_cpu with best_sibling_cpu i.e -1. Change-Id: I09829e278e41daaaff959428ff50927aba29104c Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
-rw-r--r--kernel/sched/fair.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9abc3e65dbd9..ef00eaf41317 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3240,7 +3240,8 @@ retry:
sbc_flag |= SBC_FLAG_IDLE_LEAST_LOADED;
}
} else if (stats.best_cpu >= 0) {
- if (stats.best_cpu != task_cpu(p) &&
+ if (stats.best_sibling_cpu >= 0 &&
+ stats.best_cpu != task_cpu(p) &&
stats.min_cost == stats.best_sibling_cpu_cost) {
stats.best_cpu = stats.best_sibling_cpu;
sbc_flag |= SBC_FLAG_BEST_SIBLING;