[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jk9DApNSo7Nq3ZMJh93NT89u310eHtkDwoS2mRj5N+=Q@mail.gmail.com>
Date: Fri, 28 Jul 2023 19:07:02 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: anna-maria@...utronix.de, rafael@...nel.org, tglx@...utronix.de,
frederic@...nel.org, gautham.shenoy@....com,
linux-kernel@...r.kernel.org, daniel.lezcano@...aro.org,
linux-pm@...r.kernel.org, mingo@...hat.com, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com
Subject: Re: [RFC][PATCH 3/3] cpuidle,teo: Improve state selection
On Fri, Jul 28, 2023 at 5:01 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> When selecting a state, stop when history tells us 66% of recent idles
> were at or below our current state.
This is not really about "recent idles" AFAICS. It stops the
selection when 66% of the total sum of the "hits" and "intercepts"
signals comes from the current state and the states below it. This
covers the entire history, while the "recent" ones are counted
separately.
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> drivers/cpuidle/governors/teo.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> --- a/drivers/cpuidle/governors/teo.c
> +++ b/drivers/cpuidle/governors/teo.c
> @@ -363,6 +363,7 @@ static int teo_select(struct cpuidle_dri
> unsigned int idx_hit_sum = 0;
> unsigned int hit_sum = 0;
> unsigned int tick_sum = 0;
> + unsigned int thresh_sum = 0;
> int constraint_idx = 0;
> int idx0 = 0, idx = -1;
> bool alt_intercepts, alt_recent;
> @@ -397,6 +398,8 @@ static int teo_select(struct cpuidle_dri
> duration_ns = tick_nohz_get_sleep_length(&delta_tick);
> cpu_data->sleep_length_ns = duration_ns;
>
> + thresh_sum = 2 * cpu_data->total / 3; /* 66% */
> +
> /*
> * Find the deepest idle state whose target residency does not exceed
> * the current sleep length and the deepest idle state not deeper than
> @@ -427,6 +430,9 @@ static int teo_select(struct cpuidle_dri
> if (s->target_residency_ns > duration_ns)
> break;
>
> + if (intercept_sum + hit_sum > thresh_sum)
> + break;
> +
> idx = i;
>
> if (s->exit_latency_ns <= latency_req)
>
>
Powered by blists - more mailing lists