Re: [PATCH v10 07/11] sched: get CPU's usage statistic

From: Vincent Guittot
Date: Fri Mar 27 2015 - 11:38:12 EST


On 27 March 2015 at 16:12, Xunlei Pang <pang.xunlei@xxxxxxxxxx> wrote:
> Hi Vincent,
>
> On 27 February 2015 at 23:54, Vincent Guittot
> <vincent.guittot@xxxxxxxxxx> 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?

Yes, SCHED_LOAD_SCALE is the default value but the capacity can be in
the range [1536:512] for arm as an example

>
> -Xunlei
>
>> +
>> + return (usage * capacity) >> SCHED_LOAD_SHIFT;
>> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/