Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753152AbdGNBwW (ORCPT ); Thu, 13 Jul 2017 21:52:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56604 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752569AbdGNBwU (ORCPT ); Thu, 13 Jul 2017 21:52:20 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4D178608EA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=skannan@codeaurora.org Message-ID: <596823D2.9010606@codeaurora.org> Date: Thu, 13 Jul 2017 18:52:18 -0700 From: Saravana Kannan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Viresh Kumar CC: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: schedutil: Update cached "current frequency" when limits change References: <1499826256-23491-1-git-send-email-skannan@codeaurora.org> <20170712052448.GI17115@vireshk-i7> In-Reply-To: <20170712052448.GI17115@vireshk-i7> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1858 Lines: 48 On 07/11/2017 10:24 PM, Viresh Kumar wrote: > On 11-07-17, 19:24, Saravana Kannan wrote: >> Currently, the governor calculates the next frequency, set the current CPU >> frequency (policy->cur). It also assumes the current CPU frequency doesn't >> change if the next frequency isn't calculated again and hence caches the >> "current frequency". >> >> However, this isn't true when CPU min/max frequency limits are changed. So, >> there's room for the CPU frequency to get stuck at the wrong level if the >> calculated next frequency doesn't change across multiple limits updates. >> >> Fix this by updating the cached "current frequency" when limits changes the >> current CPU frequency. >> >> Signed-off-by: Saravana Kannan >> --- >> kernel/sched/cpufreq_schedutil.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c >> index 076a2e3..fe0b2fb 100644 >> --- a/kernel/sched/cpufreq_schedutil.c >> +++ b/kernel/sched/cpufreq_schedutil.c >> @@ -226,6 +226,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, >> >> busy = sugov_cpu_is_busy(sg_cpu); >> >> + raw_spin_lock(&sg_policy->update_lock); >> if (flags & SCHED_CPUFREQ_RT_DL) { >> next_f = policy->cpuinfo.max_freq; >> } else { >> @@ -240,6 +241,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, >> next_f = sg_policy->next_freq; >> } >> sugov_update_commit(sg_policy, time, next_f); >> + raw_spin_unlock(&sg_policy->update_lock); > > We wouldn't allow locking here until the time we can :) > Actually, can you clarify why you can't allow locking here? -Saravana -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project