sched: Account for cpu's current frequency when calculating its power cost
In estimating cost of running a task on a given cpu, cost of cpu at its current frequency needs to over-ride cost at frequency demanded by task, where cur_freq exceeds required frequency of task. This is because placing a task on a cpu can only result in an increase of cpu's frequency. Change-Id: I021a3bbaf179bf1ec2c7f4556870256936797eb9 Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
This commit is contained in:
parent
3f2beb24f2
commit
9b71fb7cbb
1 changed files with 3 additions and 0 deletions
|
@ -2840,6 +2840,7 @@ unsigned int power_cost_at_freq(int cpu, unsigned int freq)
|
|||
static unsigned int power_cost(struct task_struct *p, int cpu)
|
||||
{
|
||||
unsigned int demand;
|
||||
unsigned int cur_freq = cpu_rq(cpu)->cur_freq;
|
||||
|
||||
if (!sysctl_sched_enable_power_aware || sched_use_pelt)
|
||||
return cpu_rq(cpu)->capacity;
|
||||
|
@ -2851,6 +2852,8 @@ static unsigned int power_cost(struct task_struct *p, int cpu)
|
|||
demand *= cpu_rq(cpu)->max_possible_freq;
|
||||
demand /= 100; /* khz needed */
|
||||
|
||||
demand = max(cur_freq, demand);
|
||||
|
||||
return power_cost_at_freq(cpu, demand);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue