From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Doug Smythies <dsmythies@telus.net>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linux PM <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: Re: [PATCH 4/4] cpuidle: teo: Fix "early hits" handling for disabled idle states
Date: Tue, 5 Nov 2019 23:15:35 +0100 [thread overview]
Message-ID: <CAJZ5v0h_cBa_q_XjWk-9RuOnf2yS+u3eH7A-tT=tH+Gmjh8H1w@mail.gmail.com> (raw)
In-Reply-To: <001701d59412$5804f620$080ee260$@net>
On Tue, Nov 5, 2019 at 8:51 PM Doug Smythies <dsmythies@telus.net> wrote:
>
> On 2019.10.10 14:38 Rafael J. Wysocki wrote:
>
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > The TEO governor uses idle duration "bins" defined in accordance with
> > the CPU idle states table provided by the driver, so that each "bin"
> > covers the idle duration range between the target residency of the
> > idle state corresponding to it and the target residency of the closest
> > deeper idle state. The governor collects statistics for each bin
> > regardless of whether or not the idle state corresponding to it is
> > currently enabled.
> >
> > In particular, the "early hits" metric measures the likelihood of a
> > situation in which the idle duration measured after wakeup falls into
> > to given bin, but the time till the next timer (sleep length) falls
> > into a bin corresponding to one of the deeper idle states. It is
> > used when the "hits" and "misses" metrics indicate that the state
> > "matching" the sleep length should not be selected, so that the state
> > with the maximum "early hits" value is selected instead of it.
> >
> > If the idle state corresponding to the given bin is disabled, it
> > cannot be selected and if it turns out to be the one that should be
> > selected, a shallower idle state needs to be used instead of it.
> > Nevertheless, the metrics collected for the bin corresponding to it
> > are still valid and need to be taken into account as though that
> > state had not been disabled.
> >
> > As far as the "early hits" metric is concerned, teo_select() tries to
> > take disabled states into account, but the state index corresponding
> > to the maximum "early hits" value computed by it may be incorrect.
> > Namely, it always uses the index of the previous maximum "early hits"
> > state then, but there may be enabled idle states closer to the
> > disabled one in question. In particular, if the current candidate
> > state (whose index is the idx value) is closer to the disabled one
> > and the "early hits" value of the disabled state is greater than the
> > current maximum, the index of the current candidate state (idx)
> > should replace the "maximum early hits state" index.
> >
> > Modify the code to handle that case correctly.
> >
> > Fixes: b26bf6ab716f ("cpuidle: New timer events oriented governor for tickless systems")
> > Reported-by: Doug Smythies <dsmythies@telus.net>
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> I tested this pretty patch set thoroughly, but can not claim exhaustively.
> I did my best to mess it up via trying weird scenarios.
> Unrelated issues discovered during testing are being handled on
> other e-mail threads.
>
> Tested-by: Doug Smythies <dsmythies@telus.net>
Thanks for the testing and reviews, much appreciated!
next prev parent reply other threads:[~2019-11-05 22:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 21:30 [PATCH 0/4] cpuidle: teo: Fix issues related to disabled idle states Rafael J. Wysocki
2019-10-10 21:32 ` [PATCH 1/4] cpuidle: teo: Ignore disabled idle states that are too deep Rafael J. Wysocki
2019-11-05 19:50 ` Doug Smythies
2019-10-10 21:32 ` [PATCH 2/4] cpuidle: teo: Rename local variable in teo_select() Rafael J. Wysocki
2019-11-05 19:50 ` Doug Smythies
2019-10-10 21:36 ` [PATCH 3/4] cpuidle: teo: Consider hits and misses metrics of disabled states Rafael J. Wysocki
2019-11-05 19:50 ` Doug Smythies
2019-10-10 21:37 ` [PATCH 4/4] cpuidle: teo: Fix "early hits" handling for disabled idle states Rafael J. Wysocki
2019-11-05 19:50 ` Doug Smythies
2019-11-05 22:15 ` Rafael J. Wysocki [this message]
2019-10-18 7:21 ` [PATCH 0/4] cpuidle: teo: Fix issues related to " Doug Smythies
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='CAJZ5v0h_cBa_q_XjWk-9RuOnf2yS+u3eH7A-tT=tH+Gmjh8H1w@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=dsmythies@telus.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=srinivas.pandruvada@linux.intel.com \
/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).