From b2d18bdfa38e1f1d13f19aab9fc664b9dd3712b4 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 May 2015 12:08:11 +0800 Subject: [PATCH] cpufreq: interactive: only apply interactive boost when enabled Only apply the interactive boost when the interactive governor is enabled. This seems like the right thing to do. This was originally reviewed on https://chromium-review.googlesource.com/273501 Change-Id: I5f4a7320683eada099f9a4253e3d6b0f03057fe8 Signed-off-by: Daniel Kurtz Reviewed-by: Douglas Anderson Signed-off-by: Dmitry Torokhov --- drivers/cpufreq/cpufreq_interactive.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 5224e897d460..bd83be39f17b 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -622,9 +622,20 @@ static void cpufreq_interactive_boost(struct cpufreq_interactive_tunables *tunab for_each_online_cpu(i) { pcpu = &per_cpu(cpuinfo, i); - if (tunables != pcpu->policy->governor_data) + + if (!down_read_trylock(&pcpu->enable_sem)) continue; + if (!pcpu->governor_enabled) { + up_read(&pcpu->enable_sem); + continue; + } + + if (tunables != pcpu->policy->governor_data) { + up_read(&pcpu->enable_sem); + continue; + } + spin_lock_irqsave(&pcpu->target_freq_lock, flags[1]); if (pcpu->target_freq < tunables->hispeed_freq) { pcpu->target_freq = tunables->hispeed_freq; @@ -634,6 +645,8 @@ static void cpufreq_interactive_boost(struct cpufreq_interactive_tunables *tunab anyboost = 1; } spin_unlock_irqrestore(&pcpu->target_freq_lock, flags[1]); + + up_read(&pcpu->enable_sem); } spin_unlock_irqrestore(&speedchange_cpumask_lock, flags[0]); -- 2.34.1