Re: [PATCH 2/11] cpufreq: governor: Use common mutex for dbs_data protection

From: Rafael J. Wysocki
Date: Thu Feb 04 2016 - 11:46:14 EST


On Thu, Feb 4, 2016 at 6:09 AM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On 04-02-16, 00:16, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>>
>> Every governor relying on the common code in cpufreq_governor.c
>> has to provide its own mutex in struct common_dbs_data. However,
>> those mutexes are never used at the same time
>
> Why do you think so? I thought they can always be used in parallel.
>
> Consider 2 or more policies, one can have ondemand as the governor,
> whereas other one can have conservative.
>
> If CPUs go online/offline or if governors are switching in parallel,
> then cpufreq_governor_dbs() can very much run in parallel for ondemand
> and conservative.
>
> Or am I missing something here ?

Well, so perhaps the changelog is inaccurate.

However, what's wrong with using a single mutex then?

Thanks,
Rafael