Quoting Daniel Lezcano (2015-04-29 05:23:18)
On 04/27/2015 09:46 AM, Michael Turquette wrote:
get_cpu_usage and capacity_orig_of are useful for a cpu frequency scaling policy which is based on cfs load tracking and cpu capacity metrics. Expose these calls in sched.h so that they can be used in such a policy.
Signed-off-by: Michael Turquette mturquette@linaro.org
changes since internal v1:
exported capacity_orig_of
kernel/sched/fair.c | 4 ++-- kernel/sched/sched.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 75aec8d..393fc36 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4366,7 +4366,7 @@ static unsigned long capacity_of(int cpu) return cpu_rq(cpu)->cpu_capacity; }
-static unsigned long capacity_orig_of(int cpu) +unsigned long capacity_orig_of(int cpu) { return cpu_rq(cpu)->cpu_capacity_orig; } @@ -4801,7 +4801,7 @@ done:
- Without capping the usage, a group could be seen as overloaded (CPU0 usage
- at 121% + CPU1 usage at 80%) whereas CPU1 has 20% of available capacity
*/ -static int get_cpu_usage(int cpu) +int get_cpu_usage(int cpu) { unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg; unsigned long capacity = capacity_orig_of(cpu); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index e0e1299..63a8be9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1396,6 +1396,9 @@ unsigned long arch_scale_freq_capacity(struct sched_domain *sd, int cpu) } #endif
+int get_cpu_usage(int cpu); +unsigned long capacity_orig_of(int cpu);
This one could be changed to a static inline in the header file, no ?
Yes it could. I'll update the patch.
Regards, Mike
- static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) { rq->rt_avg += rt_delta * arch_scale_freq_capacity(NULL, cpu_of(rq));
-- http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro Facebook | http://twitter.com/#!/linaroorg Twitter | http://www.linaro.org/linaro-blog/ Blog