ANDROID: sched: Compute cpu capacity available at current frequency

capacity_orig_of() returns the max available compute capacity of a cpu.
For scale-invariant utilization tracking and energy-aware scheduling
decisions it is useful to know the compute capacity available at the
current OPP of a cpu.

cc: Ingo Molnar <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: Andres Oportus <andresoportus@google.com>
This commit is contained in:
Morten Rasmussen
2015-01-13 14:11:28 +00:00
committed by Dmitry Shmidt
parent 1f998b3593
commit 8b35ef456f

View File

@@ -5104,6 +5104,17 @@ static void record_wakee(struct task_struct *p)
}
}
/*
* Returns the current capacity of cpu after applying both
* cpu and freq scaling.
*/
static unsigned long capacity_curr_of(int cpu)
{
return cpu_rq(cpu)->cpu_capacity_orig *
arch_scale_freq_capacity(NULL, cpu)
>> SCHED_CAPACITY_SHIFT;
}
static inline bool energy_aware(void)
{
return sched_feat(ENERGY_AWARE);