summaryrefslogtreecommitdiff
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorOlav Haugan <ohaugan@codeaurora.org>2015-08-10 16:41:44 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:02:27 -0700
commit03a683a55c450e26f1ebde7400f64a4b7ecd68c2 (patch)
tree89d641bf72662652aff71607161baac88b731110 /kernel/sched/fair.c
parent4996dafe6875f2804d525e6ac74162e3efc4cda3 (diff)
sched: Add tunables for static cpu and cluster cost
Add per-cpu tunable to set the extra cost to use a CPU that is idle. Add the same for a cluster. Change-Id: I4aa53f3c42c963df7abc7480980f747f0413d389 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> [joonwoop@codeaurora.org: omitted changes for qhmp*.[c,h] stripped out CONFIG_SCHED_QHMP in drivers/base/cpu.c and include/linux/sched.h] Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r--kernel/sched/fair.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 27e1a3d7bb05..f009c718fd82 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3091,14 +3091,13 @@ static unsigned int power_cost_at_freq(int cpu, unsigned int freq)
BUG();
}
-/* Return the cost of running task p on CPU cpu. This function
- * currently assumes that task p is the only task which will run on
- * the CPU. */
+/* Return the cost of running the total task load total_load on CPU cpu. */
unsigned int power_cost(u64 total_load, int cpu)
{
unsigned int task_freq;
struct rq *rq = cpu_rq(cpu);
u64 demand;
+ int total_static_pwr_cost = 0;
if (!sysctl_sched_enable_power_aware)
return rq->max_possible_capacity;
@@ -3110,7 +3109,12 @@ unsigned int power_cost(u64 total_load, int cpu)
task_freq = demand * rq->max_possible_freq;
task_freq /= 100; /* khz needed */
- return power_cost_at_freq(cpu, task_freq);
+ if (idle_cpu(cpu) && rq->cstate) {
+ total_static_pwr_cost += rq->static_cpu_pwr_cost;
+ if (rq->dstate)
+ total_static_pwr_cost += rq->static_cluster_pwr_cost;
+ }
+ return power_cost_at_freq(cpu, task_freq) + total_static_pwr_cost;
}
#define UP_MIGRATION 1