diff options
| author | Morten Rasmussen <morten.rasmussen@arm.com> | 2015-01-13 14:11:28 +0000 |
|---|---|---|
| committer | Leo Yan <leo.yan@linaro.org> | 2016-05-10 16:49:50 +0800 |
| commit | 3e55d2f2fcaf44ac19eb143d895924ff402e375c (patch) | |
| tree | c31924b8cf588a3d531b63508bd4333ba0867dc6 /kernel | |
| parent | 7c791bf110c2c1884f02f0c4ceaff886fad2a907 (diff) | |
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>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/fair.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index efc65c3db6b5..ea966d9193cd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4651,6 +4651,17 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) #endif +/* + * 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); |
