mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: 朱恺乾 <zhukaiqian@xiaomi.com>, "rafael@kernel.org" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"quic_zhonhan@quicinc.com" <quic_zhonhan@quicinc.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] cpuidle: menu: find the typical interval by a heuristic classification method
Date: Thu, 21 Aug 2025 09:49:31 +0100	[thread overview]
Message-ID: <9fd90f29-72c4-42b7-bd28-08e2cbc9a472@arm.com> (raw)
In-Reply-To: <f2bab6677d4b4fe585f7e01b1e490717@xiaomi.com>

On 8/21/25 02:54, 朱恺乾 wrote:
> Menu governor relies on get_typical_interval() to find the repeating
> idle interval from the history, but it can not handle the case when
> there're two or more repeating patterns. The calculation of deviation
> always leads to a single closely connected intervals.
> 
> In order to find all the possible repeating intervals and choose the
> most promising one for the next idle. This algorithm is classifying
> the idle histories heuristically by the state it is in. It changes
> the behavior of the function to look for the repeating state actually,
> but it still meets the goal of choosing an idle state.
> 
> The occurrence of each state is counted and their average is calculated.
> The average value of each state would be taken as a repeating pattern.
> To find the one most likely to happen, weights are added to the
> histories by the order of time, so the state has the highest weight, or
> occurs most often in the recent history, is selected, and it's average
> is returned as the typical interval.
> 
> Considering the fact that some idle intervals may be very close to another
> state, the algorithm calculates the distance to each average, and do the
> re-classification once by putting the history into the state closer to it.
> It makes the state average possible to derive an average under or above the
> state residency.
> 
> Comparing with the deviation calculation, this method
> 1) can find multiple patterns from the history and choose from them
> 2) can be more sensitive to the changing workload as the threshold is
> lowered
> 3) puts time into consideration, so prediction won't stuck in the stale
> histories
> 
> Signed-off-by: Kaiqian Zhu <zhukaiqian@xiaomi.com>
> ---
>  drivers/cpuidle/governors/menu.c | 172 ++++++++++++++++---------------
>  1 file changed, 89 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 81306612a5c6..5b279ae07b16 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -107,109 +107,115 @@ static void menu_update_intervals(struct menu_device *data, unsigned int interva
> 
>  static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev);
> 
> +static int get_actual_state(struct cpuidle_driver *drv,
> +    struct cpuidle_device *dev,
> +    int duration_us)
> +{
> +int actual;
> +
> +for (int i = 0; i < drv->state_count; i++) {
> +if (duration_us < drv->states[i].target_residency)
> +break;
> +
> +actual = i;
> +}
> +
> +return actual;
> +}
> +

FYI Something went wrong witch the patch here...

      reply	other threads:[~2025-08-21  8:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ec528693bdf84a61829427c4988bfa85@xiaomi.com>
2025-08-21  1:54 ` 朱恺乾
2025-08-21  8:49   ` Christian Loehle [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=9fd90f29-72c4-42b7-bd28-08e2cbc9a472@arm.com \
    --to=christian.loehle@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=quic_zhonhan@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=zhukaiqian@xiaomi.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

all inboxes | Powered by JetHome®