Weekends...

> Provide a new helper function which sums up a given type of cpustat
> over a specified cpumask.

> This allows the caller's code to be simpler and avoids duplication.
> For example, subsequent patch in the steal governor use this exact
> same pattern when calculating steal time.

> @@ -207,16 +207,12 @@ static unsigned long hd_calculate_steal_percentage(void)
>  {
>       unsigned long time_delta, steal_delta, steal, percentage;
>       static ktime_t prev;
> -     int cpus, cpu;
> +     int cpus;
>       ktime_t now;
>  
> -     cpus = 0;
> -     steal = 0;
>       percentage = 0;
> -     for_each_cpu(cpu, &hd_vmvl_cpumask) {
> -             steal += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL];
> -             cpus++;
> -     }
> +     steal = kcpustat_field_total(CPUTIME_STEAL, &hd_vmvl_cpumask);
> +     cpus = cpumask_weight(&hd_vmvl_cpumask);

nit. The cpumask_weight() change is not mentioned in the commit message.

Thanks,
Kayra :>

Reply via email to