public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Miedl <philipp.miedl@tik.ee.ethz.ch>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: alex@digriz.org.uk, jun.nakajima@intel.com,
	venkatesh.pallipadi@intel.com,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: Delayed acpi frequency governor call
Date: Fri, 20 Jan 2017 16:27:30 +0100	[thread overview]
Message-ID: <9b332b49-11a1-a5fc-d48e-2c113cdca202@tik.ee.ethz.ch> (raw)
In-Reply-To: <20170120100725.GO11478@vireshk-i7>

On 20.01.2017 11:07, Viresh Kumar wrote:
> + PM list.
>
> On 20-01-17, 10:48, Philipp Miedl wrote:
>> Hi!
>>
>> I'm using the kernel version 4.4.0-59-generic and 4.4.0 with acpi cpufreq
>> drivers (cpufrequtils 008) on a Lenovo T440p laptop. Now I've bumped into
>> some weird behaviour:
>> it can happen that the call to the governor is delayed for so long, that in
>> the governor the if-statement in cpufreq_governor.c line 138
>> is true, which means the governor thinks the cpu was idle. This can lead to
>> the case that the frequency is still scaled up when it should in
>> fact be scaled down.
>>
>> Now I've written a small programm which ensures that the cpu is never idle
>> for longer than 850us, but does not generate a cpu utilization higher
>> than 5% - still the behaviour is the same. I've looked a bit closer at this
>> and I figured out that if I increase the utilization of the observed CPU,
>> at utilzations higher than 80% the maximum delay between two governor calls
>> increases and can rise almost to 10x sampling rate
>> (/sys/drivers/system/cpu/cpufreq/sampling_rate).
>> Weirdly enough, after a long time (>1s) the average call time of the
>> governor is always around the specified sampling rate.
>>
>> I could not fully understand how the governor is call and this work queue
>> works and therefore I also have a hard time making sense of this behaviour.
>> Can anyone please help me out?
> Have a look at below commit:
>
> commit 00bfe05889e9 ("cpufreq: conservative: Decrease frequency faster
> for deferred updates")
>
> It may be related to what you are observing.
>

This is not my issue. The code I'm referring to can be found in 
cpufreq_governor.c:
<-->
if (unlikely(wall_time > (2 * sampling_rate) &&
        j_cdbs->prev_load)) {
   load = j_cdbs->prev_load;

   /*
    * Perform a destructive copy, to ensure that we copy
    * the previous load only once, upon the first wake-up
    * from idle.
    */
   j_cdbs->prev_load = 0;
} else {
   load = 100 * (wall_time - idle_time) / wall_time;
   j_cdbs->prev_load = load;
}
<-->

How can it happen that "unlikely(wall_time > (2 * sampling_rate)" is 
true although the CPU utilization was 5%?

Thanks

-- 
--------------------------------------------------------------------
|  Philipp Miedl                                                   |
|  PhD Student @ Computer Engineering and Networks Laboratory      |
|  ETH Zurich, ETZG76, Gloriastrasse 35, 8092 Zurich, Switzerland  |
|  mail: philipp.miedl@ee.tik.ethz.ch      phone: +41 44 632 70 61 |
--------------------------------------------------------------------


  reply	other threads:[~2017-01-20 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c8ee7078-ad5a-0a23-66ae-620c507300e5@tik.ee.ethz.ch>
2017-01-20 10:07 ` Delayed acpi frequency governor call Viresh Kumar
2017-01-20 15:27   ` Philipp Miedl [this message]
2017-01-23 10:11     ` Viresh Kumar
2017-01-23 14:24       ` Philipp Miedl
2017-01-24  4:22         ` Viresh Kumar
2017-01-24 14:49           ` Philipp Miedl
2017-01-25  3:23             ` Viresh Kumar
2017-01-25  9:48               ` Philipp Miedl

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=9b332b49-11a1-a5fc-d48e-2c113cdca202@tik.ee.ethz.ch \
    --to=philipp.miedl@tik.ee.ethz.ch \
    --cc=alex@digriz.org.uk \
    --cc=jun.nakajima@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=venkatesh.pallipadi@intel.com \
    --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