--- zzzz-none-000/linux-4.4.60/drivers/cpufreq/cpufreq_conservative.c 2017-04-08 07:53:53.000000000 +0000 +++ wasp-540e-714/linux-4.4.60/drivers/cpufreq/cpufreq_conservative.c 2019-07-03 09:21:34.000000000 +0000 @@ -22,6 +22,7 @@ #define MAX_SAMPLING_DOWN_FACTOR (10) static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info); +static DEFINE_PER_CPU(unsigned int, cpufreq_stat_stepdown); static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event); @@ -64,6 +65,21 @@ struct dbs_data *dbs_data = policy->governor_data; struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; + //notify of no change so cpufreq stats can continuously measure + //statistics even when frequency does not change + struct cpufreq_freqs freqs; + freqs.cpu=cpu; + freqs.old=policy->cur; + freqs.new=policy->cur; + + //however only do this every tenth time + if( per_cpu(cpufreq_stat_stepdown, cpu) < 9 ) { + per_cpu(cpufreq_stat_stepdown, cpu)++; + } else { + per_cpu(cpufreq_stat_stepdown, cpu)=0; + cpufreq_notify_transition(policy, &freqs, CPUFREQ_NOCHANGE); + } + /* * break out if we 'cannot' reduce the speed as the user might * want freq_step to be zero @@ -85,7 +101,7 @@ dbs_info->requested_freq = policy->max; __cpufreq_driver_target(policy, dbs_info->requested_freq, - CPUFREQ_RELATION_H); + CPUFREQ_RELATION_H); return; } @@ -384,6 +400,11 @@ static int __init cpufreq_gov_dbs_init(void) { + unsigned int cpu; + + for_each_online_cpu(cpu) { + per_cpu(cpufreq_stat_stepdown, cpu) = 0; + } return cpufreq_register_governor(&cpufreq_gov_conservative); }