• Viresh Kumar's avatar
    cpufreq: ondemand: Update sampling rate only for concerned policies · e128c864
    Viresh Kumar authored
    We are comparing policy->governor against cpufreq_gov_ondemand to make
    sure that we update sampling rate only for the concerned CPUs. But that
    isn't enough.
    
    In case of governor_per_policy, there can be multiple instances of
    ondemand governor and we will always end up updating all of them with
    current code. What we rather need to do, is to compare dbs_data with
    poilcy->governor_data, which will match only for the policies governed
    by dbs_data.
    
    This code is also racy as the governor might be getting stopped at that
    time and we may end up scheduling work for a policy, which we have just
    disabled.
    
    Fix that by protecting the entire function with &od_dbs_cdata.mutex,
    which will prevent against races with policy START/STOP/etc.
    
    After these locks are in place, we can safely get the policy via per-cpu
    dbs_info.
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    e128c864
cpufreq_ondemand.c 17.5 KB