linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <skannan@codeaurora.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: schedutil: Update cached "current frequency" when limits change
Date: Thu, 13 Jul 2017 18:52:18 -0700	[thread overview]
Message-ID: <596823D2.9010606@codeaurora.org> (raw)
In-Reply-To: <20170712052448.GI17115@vireshk-i7>

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 <skannan@codeaurora.org>
>> ---
>>   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

  parent reply	other threads:[~2017-07-14  1:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  2:24 [PATCH] cpufreq: schedutil: Update cached "current frequency" when limits change Saravana Kannan
2017-07-12  5:24 ` Viresh Kumar
2017-07-12 17:44   ` Saravana Kannan
2017-07-14  1:52   ` Saravana Kannan [this message]
2017-07-14  4:05     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=596823D2.9010606@codeaurora.org \
    --to=skannan@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).