Hi Vincent,
On 27 February 2015 at 23:54, Vincent Guittot vincent.guittot@linaro.org wrote:
Monitor the usage level of each group of each sched_domain level. The usage is the portion of cpu_capacity_orig that is currently used on a CPU or group of CPUs. We use the utilization_load_avg to evaluate the usage level of each group.
The utilization_load_avg only takes into account the running time of the CFS tasks on a CPU with a maximum value of SCHED_LOAD_SCALE when the CPU is fully utilized. Nevertheless, we must cap utilization_load_avg which can be temporaly greater than SCHED_LOAD_SCALE after the migration of a task on this CPU and until the metrics are stabilized.
- at 121% + CPU1 usage at 80%) whereas CPU1 has 20% of available capacity/
- */
+static int get_cpu_usage(int cpu) +{
unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg;
unsigned long capacity = capacity_orig_of(cpu);
if (usage >= SCHED_LOAD_SCALE)
return capacity;
Can "capacity" be greater than SCHED_LOAD_SCALE? Why use SCHED_LOAD_SCALE instead of "capacity" in this judgement?
-Xunlei
return (usage * capacity) >> SCHED_LOAD_SHIFT;
+}