linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: viresh.kumar@linaro.org, svaidy@linux.vnet.ibm.com,
	ego@linux.vnet.ibm.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] cpufreq: governor: Be friendly towards latency-sensitive bursty workloads
Date: Sat, 07 Jun 2014 02:55:32 +0530	[thread overview]
Message-ID: <539231CC.8070803@linux.vnet.ibm.com> (raw)
In-Reply-To: <1574521.TWqGMgFGby@vostro.rjw.lan>

On 06/07/2014 03:07 AM, Rafael J. Wysocki wrote:
> On Wednesday, June 04, 2014 03:17:00 AM Srivatsa S. Bhat wrote:
>> Cpufreq governors like the ondemand governor calculate the load on the CPU
>> periodically by employing deferrable timers. A deferrable timer won't fire
>> if the CPU is completely idle (and there are no other timers to be run), in
>> order to avoid unnecessary wakeups and thus save CPU power.
>>
>> However, the load calculation logic is agnostic to all this, and this can
>> lead to the problem described below.
>>
>>
>> Time (ms)               CPU 1
>>
>> 100                Task-A running
>>
>> 110                Governor's timer fires, finds load as 100% in the last
>>                    10ms interval and increases the CPU frequency.
>>
>> 110.5              Task-A running
>>
>> 120		   Governor's timer fires, finds load as 100% in the last
>> 		   10ms interval and increases the CPU frequency.
>>
>> 125		   Task-A went to sleep. With nothing else to do, CPU 1
>> 		   went completely idle.
>>
>> 200		   Task-A woke up and started running again.
>>
>> 200.5		   Governor's deferred timer (which was originally programmed
>> 		   to fire at time 130) fires now. It calculates load for the
>> 		   time period 120 to 200.5, and finds the load is almost zero.
>> 		   Hence it decreases the CPU frequency to the minimum.
>>
>> 210		   Governor's timer fires, finds load as 100% in the last
>> 		   10ms interval and increases the CPU frequency.
>>
>>
>> So, after the workload woke up and started running, the frequency was suddenly
>> dropped to absolute minimum, and after that, there was an unnecessary delay of
>> 10ms (sampling period) to increase the CPU frequency back to a reasonable value.
>> And this pattern repeats for every wake-up-from-cpu-idle for that workload.
>> This can be quite undesirable for latency- or response-time sensitive bursty
>> workloads. So we need to fix the governor's logic to detect such wake-up-from-
>> cpu-idle scenarios and start the workload at a reasonably high CPU frequency.
>>
>> One extreme solution would be to fake a load of 100% in such scenarios. But
>> that might lead to undesirable side-effects such as frequency spikes (which
>> might also need voltage changes) especially if the previous frequency happened
>> to be very low.
>>
>> We just want to avoid the stupidity of dropping down the frequency to a minimum
>> and then enduring a needless (and long) delay before ramping it up back again.
>> So, let us simply carry forward the previous load - that is, let us just pretend
>> that the 'load' for the current time-window is the same as the load for the
>> previous window. That way, the frequency and voltage will continue to be set
>> to whatever values they were set at previously. This means that bursty workloads
>> will get a chance to influence the CPU frequency at which they wake up from
>> cpu-idle, based on their past execution history. Thus, they might be able to
>> avoid suffering from slow wakeups and long response-times.
>>
>> [ The right way to solve this problem is to teach the CPU frequency governors
>> to track load on a per-task basis, not a per-CPU basis, and set the appropriate
>> frequency on whichever CPU the task executes. But that involves redesigning
>> the cpufreq subsystem, so this patch should make the situation bearable until
>> then. ]
>>
>> Experimental results:
>> ====================
> 
> This formatting of the changelog evidently confused Patchwork.
> 

Oh, I didn't realize that that would create problems!

> That's not a big deal, but please try to avoid that in the future if possible.
> 

Sorry, I'll be careful next time. Thanks for letting me know!

Regards,
Srivatsa S. Bhat


      reply	other threads:[~2014-06-06 21:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 21:47 [PATCH v2] cpufreq: governor: Be friendly towards latency-sensitive bursty workloads Srivatsa S. Bhat
2014-06-06 21:37 ` Rafael J. Wysocki
2014-06-06 21:25   ` Srivatsa S. Bhat [this message]

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=539231CC.8070803@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=svaidy@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).