cpufreq.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: cpufreq@vger.kernel.org
Subject: [Bug 69821] setting CONFIG_HZ_PERIODIC locks cpu at the lowest frequency using ONDEMAND
Date: Wed, 16 Dec 2015 02:09:55 +0000	[thread overview]
Message-ID: <bug-69821-12968-K7RHX470fZ@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-69821-12968@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=69821

--- Comment #5 from Chen Yu <yu.c.chen@intel.com> ---
There is a problem in cpufreq_governor.c on how to calculate the load
for each policy:

it uses get_cpu_idle_time to get the total idle time for current cpu, if it
is config with CONFIG_NO_HZ_FULL , it is OK, because as mentioned in #Comment
4, the time is return by ktime_get, which is always increasing. However,
it is config with CONFIG_HZ_PERIODIC , the situation would be changed,
now it uses tick count to calculate the idle time by get_cpu_idle_time_jiffy,
consider the following scenario:

At T1: 
idle_tick_1 = total_tick_1 - user_tick_1

At T2: ( T2 = T1 + 80ms):
idle_tick_2 = total_tick_2 - user_tick_2


Since current algorithm to get the idle time for the past sampling, is by
caculcating (idle_tick_2 - idle_tick_1), but since you CAN NOT guarantee that
idle_tick_2 is bigger than idle_tick_1, we might get a negative value for idle
time during the past sample, which might cause the system thinks its idle time 
is very big, and the busy time is near zero, which cause the governor to always
choose the lowest cpufreq state, which cause this problem.





There are two solutions for this problem:
1. Since the root cause for this problem is that, we should not rely on idle
tick in every sample time, but should rely on the busy time directly in each
sample, as the latter is how 'top' command implement its feature.

2. Or we can also work around it by making sure the idle_time is strictly
increasing in each sample. This solution needs minimum modification and the RFC
patch is attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.

  parent reply	other threads:[~2015-12-16  2:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-69821-12968@https.bugzilla.kernel.org/>
2014-02-07  2:40 ` [Bug 69821] setting CONFIG_HZ_PERIODIC locks cpu at the lowest frequency using ONDEMAND bugzilla-daemon
2014-02-11  0:52 ` bugzilla-daemon
2014-02-11 10:01 ` bugzilla-daemon
2014-06-03  6:14 ` bugzilla-daemon
2015-12-15  0:12 ` bugzilla-daemon
2015-12-16  2:09 ` bugzilla-daemon [this message]
2015-12-16  2:15 ` bugzilla-daemon
2015-12-16  2:43 ` bugzilla-daemon

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=bug-69821-12968-K7RHX470fZ@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=cpufreq@vger.kernel.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).