From: Peter Zijlstra <peterz@infradead.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>
Subject: Re: Stopping the tick on a fully loaded system
Date: Wed, 26 Jul 2023 22:09:49 +0200 [thread overview]
Message-ID: <20230726200949.GA3869356@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAJZ5v0hLprrBhfqMRUhStvmm3D_xaSLxmNOYB4sfhLSzLYeR-w@mail.gmail.com>
On Wed, Jul 26, 2023 at 08:30:01PM +0200, Rafael J. Wysocki wrote:
> > - The governors teo and menu do the tick_nohz_next_event() check even if
> > the CPU is fully loaded and but the check is not for free.
>
> Let me have a loot at teo in that respect.
>
> The problem is when tick_nohz_get_sleep_length() should not be called.
> The easy case is when the governor would select the shallowest idle
> state without taking it into account, but what about the deeper ones?
> I guess this depends on the exit latency of the current candidate idle
> state, but what exit latency would be low enough? I guess 2 us would
> be fine, but what about 10 us, or even 20 us for that matter?
The patch I send here:
https://lkml.kernel.org/r/20230726164958.GV38236@hirez.programming.kicks-ass.net
(which was stuck in a mailqueue :/) tries to address that.
Additionally, I think we can do something like this on top of all that,
stop going deeper when 66% of wakeups is at or below the current state.
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -362,6 +362,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;
@@ -396,6 +397,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
@@ -426,6 +429,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)
next prev parent reply other threads:[~2023-07-26 20:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 6:51 Stopping the tick on a fully loaded system Anna-Maria Behnsen
2023-07-20 7:38 ` Vincent Guittot
2023-07-20 13:00 ` Anna-Maria Behnsen
2023-07-20 13:55 ` Vincent Guittot
2023-07-23 21:21 ` Frederic Weisbecker
2023-07-24 8:23 ` Rafael J. Wysocki
2023-07-25 13:07 ` Anna-Maria Behnsen
2023-07-25 14:27 ` Rafael J. Wysocki
2023-07-25 22:28 ` Peter Zijlstra
2023-07-26 15:10 ` Rafael J. Wysocki
2023-07-26 15:53 ` Rafael J. Wysocki
2023-07-26 16:14 ` Peter Zijlstra
2023-07-26 16:49 ` Peter Zijlstra
2023-07-26 21:26 ` Peter Zijlstra
2023-07-27 7:59 ` Peter Zijlstra
2023-07-27 20:10 ` Rafael J. Wysocki
2023-07-26 16:40 ` Anna-Maria Behnsen
2023-07-26 18:30 ` Rafael J. Wysocki
2023-07-26 20:09 ` Peter Zijlstra [this message]
2023-07-26 10:59 ` Frederic Weisbecker
2023-07-26 15:07 ` Rafael J. Wysocki
2023-07-26 10:47 ` Frederic Weisbecker
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=20230726200949.GA3869356@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=anna-maria@linutronix.de \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=gautham.shenoy@amd.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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