From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965801AbbJ0RjR (ORCPT ); Tue, 27 Oct 2015 13:39:17 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34812 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965775AbbJ0RjN (ORCPT ); Tue, 27 Oct 2015 13:39:13 -0400 From: =?UTF-8?q?B=C3=A1lint=20Czobor?= To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Todd Poynor , =?UTF-8?q?B=C3=A1lint=20Czobor?= Subject: [PATCH 13/70] cpufreq: interactive: set floor for boosted speed Date: Tue, 27 Oct 2015 18:30:01 +0100 Message-Id: <1445967059-6897-13-git-send-email-czoborbalint@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1445967059-6897-1-git-send-email-czoborbalint@gmail.com> References: <1445967059-6897-1-git-send-email-czoborbalint@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Todd Poynor Allow speed to drop to flooor frequency but not below, don't pin to speed at last boost. Change-Id: I0147c2b7a2e61ba16820605af6baaf09570be787 Signed-off-by: Todd Poynor Signed-off-by: Bálint Czobor --- drivers/cpufreq/cpufreq_interactive.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 07b7caf..fcd5b1d 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -47,10 +47,11 @@ struct cpufreq_interactive_cpuinfo { int idling; u64 target_set_time; u64 target_set_time_in_idle; - u64 target_validate_time; struct cpufreq_policy *policy; struct cpufreq_frequency_table *freq_table; unsigned int target_freq; + unsigned int floor_freq; + u64 floor_validate_time; int governor_enabled; }; @@ -228,10 +229,10 @@ static void cpufreq_interactive_timer(unsigned long data) new_freq = pcpu->freq_table[index].frequency; /* - * Do not scale down unless we have been at this frequency for the - * minimum sample time since last validated. + * Do not scale below floor_freq unless we have been at or above the + * floor frequency for the minimum sample time since last validated. */ - if (new_freq < pcpu->target_freq) { + if (new_freq < pcpu->floor_freq) { if (pcpu->timer_run_time - pcpu->target_validate_time < min_sample_time) { trace_cpufreq_interactive_notyet(data, cpu_load, @@ -240,7 +241,8 @@ static void cpufreq_interactive_timer(unsigned long data) } } - pcpu->target_validate_time = pcpu->timer_run_time; + pcpu->floor_freq = new_freq; + pcpu->floor_validate_time = pcpu->timer_run_time; if (pcpu->target_freq == new_freq) { trace_cpufreq_interactive_already(data, cpu_load, @@ -508,12 +510,12 @@ static void cpufreq_interactive_boost(void) } /* - * Refresh time at which current (possibly being - * boosted) speed last validated (reset timer for - * allowing speed to drop). + * Set floor freq and (re)start timer for when last + * validated. */ - pcpu->target_validate_time = ktime_to_us(ktime_get()); + pcpu->floor_freq = hispeed_freq; + pcpu->floor_validate_time = ktime_to_us(ktime_get()); } spin_unlock_irqrestore(&up_cpumask_lock, flags); @@ -811,7 +813,8 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy, pcpu->target_set_time_in_idle = get_cpu_idle_time_us(j, &pcpu->target_set_time); - pcpu->target_validate_time = + pcpu->floor_freq = pcpu->target_freq; + pcpu->floor_validate_time = pcpu->target_set_time; pcpu->governor_enabled = 1; smp_wmb(); -- 1.7.9.5