Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2017-11-16 22:21:41 +0000
committerMel Gorman <mgorman@suse.de>2017-11-16 22:21:41 +0000
commit78b0ff739f3b985027a8390081f866fb1570da25 (patch)
tree3df1b718f7cd95a4d8acb46b04e087ad2d44724f
parentf3350f2920189f3e71f6df3a612178cdf1759415 (diff)
pcc-cpufreq: Re-introduce deadband effect to reduce number of
frequency changes (bsc#981838). suse-commit: 7533cac0b42a31481c90f7b1396795717ac23436
-rw-r--r--drivers/cpufreq/pcc-cpufreq.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index 3f0ce2ae35ee..d2e2963f3ede 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -200,10 +200,26 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
{
struct pcc_cpu *pcc_cpu_data;
struct cpufreq_freqs freqs;
+ static u32 limit = 0;
+
u16 status;
u32 input_buffer;
int cpu;
+ if (!limit) {
+ u32 f_min = policy->cpuinfo.min_freq / 1000;
+ u32 f_max = policy->cpuinfo.max_freq / 1000;
+ limit = (f_max - f_min) * f_min;
+ limit /= f_max;
+ limit *= 1000;
+ limit += f_min * 1000;
+ pr_debug("pcc-cpufreq: setting deadband limit to %u kHz\n",
+ limit);
+ }
+
+ if (target_freq < limit)
+ target_freq = policy->min;
+
cpu = policy->cpu;
pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu);
@@ -214,6 +230,10 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
freqs.old = policy->cur;
freqs.new = target_freq;
+
+ if (freqs.new == freqs.old)
+ return 0;
+
cpufreq_freq_transition_begin(policy, &freqs);
spin_lock(&pcc_lock);