Re: [PATCH v5 15/23] PM: EM: Optimize em_cpu_energy() and remove division

From: Qais Yousef
Date: Thu Dec 28 2023 - 13:07:02 EST


On 11/29/23 11:08, Lukasz Luba wrote:

> @@ -220,8 +218,9 @@ static int em_compute_costs(struct device *dev, struct em_perf_state *table,
> return -EINVAL;
> }
> } else {
> - power_res = table[i].power;
> - cost = div64_u64(fmax * power_res, table[i].frequency);
> + /* increase resolution of 'cost' precision */
> + power_res = table[i].power * 10;

Power is in uW, right? You're just taking advantage here that everything will
use this new cost field so you can add as many 0s to improve resolution without
impact elsewhere that care to compare using the same units?

Did you see a problem or just being extra cautious here?

> + cost = power_res / table[i].performance;
> }
>
> table[i].cost = cost;
> --
> 2.25.1
>