Re: [PATCH] cpufreq: ondemand: Change the calculation of target frequency

From: Viresh Kumar
Date: Mon Jun 03 2013 - 02:51:59 EST


On 2 June 2013 01:07, Rafael J. Wysocki <rjw@xxxxxxx> wrote:
> On Saturday, June 01, 2013 08:26:47 PM Viresh Kumar wrote:

>> Even removal of __cpufreq_driver_getavg() should be done in a separate
>> patch, so that it can be reverted easily if required later.
>
> Why would you want to revert it separately?

We might not need to revert all the changes that Stratos is doing.
Only a revert of getavg() and its users + a small fix in governor would
be enough. Stratos patch isn't only about removing getavg() but how
ondemand works and so breaking stuff might be more useful.

>> >> "Proportional to load" means C * load, so why is "policy->max / 100" *the* right C?
>> >
>> > I think, finally(?) I see your point. The right C should be "policy->cpuinfo.max_freq / 100".
>>
>> Why are you changing it to cpuinfo.max_freq?? This is fixed once a driver is
>> initialized.. but user may request a lower max freq for a governor or policy.
>> Which is actually reflected in policy->max I believe.
>
> Which doesn't matter. The formula should provide the same results regardless
> of the user settings except that the selected frequency should be capped by
> policy->max (instead of being proportional to it). I think using
> cpuinfo.max_freq here is correct.

I am confused now about what to use.. This is how I read it:

Assumption: CPU supports following freq range.. 500 MHz, 600 MHz, 700 MHz,
800 MHz, 900 MHz, 1 GHz

cpuinfo.max_freq = 1 GHz
policy->max is set to 600 MHz

Case 1: Use policy->max:

We need load to be over 500/600 (i.e. .834) to move to 600 MHz.

Case 2: Use cpuinfo.max_freq..

We need load to be over 500/1000 (i.e. .5) to move to 600 MHz.

So, obviously the calculations aren't the same..

Now, this is how I understood these two different variables:
- cpuinfo.max_freq:

>> Over that why keeping following check is useful anymore?
>>
>> if (load_freq > od_tuners->up_threshold)
>> goto max.
>>
>> As, if load is over 95, then even policy->max * 95 / 100 will even give almost
>> the same freq.
>
> Yes, in the majority of cases.
>
> Thanks,
> Rafael
>
>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
--
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/