mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Cc: Qais Yousef <qyousef@layalina.io>,
	Thomas Gleixner <tglx@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Aboorva Devarajan <aboorvad@linux.ibm.com>
Subject: Re: [PATCH v1] sched: idle: Make skipping governor callbacks more consistent
Date: Mon, 9 Mar 2026 09:13:52 +0000	[thread overview]
Message-ID: <eaccec02-2f4d-4746-81a0-deda2125bed3@arm.com> (raw)
In-Reply-To: <12857700.O9o76ZdvQC@rafael.j.wysocki>

On 3/7/26 16:12, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> If the cpuidle governor .select() callback is skipped because there
> is only one idle state in the cpuidle driver, the .reflect() callback
> should be skipped as well, at least for consistency (if not for
> correctness), so do it.
> 
> Fixes: e5c9ffc6ae1b ("cpuidle: Skip governor when only one idle state is available")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpuidle/cpuidle.c |   10 ----------
>  kernel/sched/idle.c       |   11 ++++++++++-
>  2 files changed, 10 insertions(+), 11 deletions(-)
> 
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -359,16 +359,6 @@ noinstr int cpuidle_enter_state(struct c
>  int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>  		   bool *stop_tick)
>  {
> -	/*
> -	 * If there is only a single idle state (or none), there is nothing
> -	 * meaningful for the governor to choose. Skip the governor and
> -	 * always use state 0 with the tick running.
> -	 */
> -	if (drv->state_count <= 1) {
> -		*stop_tick = false;
> -		return 0;
> -	}
> -
>  	return cpuidle_curr_governor->select(drv, dev, stop_tick);
>  }
>  
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -221,7 +221,7 @@ static void cpuidle_idle_call(void)
>  
>  		next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);
>  		call_cpuidle(drv, dev, next_state);
> -	} else {
> +	} else if (drv->state_count > 1) {
>  		bool stop_tick = true;
>  
>  		/*
> @@ -239,6 +239,15 @@ static void cpuidle_idle_call(void)
>  		 * Give the governor an opportunity to reflect on the outcome
>  		 */
>  		cpuidle_reflect(dev, entered_state);
> +	} else {
> +		tick_nohz_idle_retain_tick();
> +
> +		/*
> +		 * If there is only a single idle state (or none), there is
> +		 * nothing meaningful for the governor to choose.  Skip the
> +		 * governor and always use state 0.
> +		 */
> +		call_cpuidle(drv, dev, 0);
>  	}
>  
>  exit_idle:
> 
> 
> 

Duh, good catch.
Reviewed-by: Christian Loehle <christian.loehle@arm.com>

  reply	other threads:[~2026-03-09  9:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 19:30 [patch 0/2] sched/idle: Prevent pointless NOHZ transitions in default_idle_call() Thomas Gleixner
2026-03-01 19:30 ` [patch 1/2] sched/idle: Make default_idle_call() static Thomas Gleixner
2026-03-01 19:30 ` [patch 2/2] sched/idle: Make default_idle_call() NOHZ aware Thomas Gleixner
2026-03-02  6:05   ` K Prateek Nayak
2026-03-02 10:43   ` Frederic Weisbecker
2026-03-02 11:03     ` Christian Loehle
2026-03-02 11:11       ` Frederic Weisbecker
2026-03-02 11:39         ` Christian Loehle
2026-03-04  3:35           ` Qais Yousef
2026-03-02 11:03   ` Christian Loehle
2026-03-02 21:25     ` Rafael J. Wysocki
2026-03-04  3:03       ` Qais Yousef
2026-03-06 21:21         ` Rafael J. Wysocki
2026-03-06 21:31           ` Rafael J. Wysocki
2026-03-07 16:25             ` Rafael J. Wysocki
2026-03-10  3:54               ` Qais Yousef
2026-03-10  9:18                 ` Christian Loehle
2026-03-10 15:03                   ` Qais Yousef
2026-03-10 15:09                     ` Rafael J. Wysocki
2026-03-10 15:14                       ` Qais Yousef
2026-03-07 16:12         ` [PATCH v1] sched: idle: Make skipping governor callbacks more consistent Rafael J. Wysocki
2026-03-09  9:13           ` Christian Loehle [this message]
2026-03-09 12:26             ` Rafael J. Wysocki
2026-03-10  3:57               ` Qais Yousef
2026-03-09 12:44           ` Aboorva Devarajan
2026-03-10 14:28           ` Frederic Weisbecker
2026-03-02 12:17   ` [patch 2/2] sched/idle: Make default_idle_call() NOHZ aware Peter Zijlstra
2026-03-02 12:19     ` Peter Zijlstra
2026-03-02 21:23       ` Rafael J. Wysocki

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=eaccec02-2f4d-4746-81a0-deda2125bed3@arm.com \
    --to=christian.loehle@arm.com \
    --cc=aboorvad@linux.ibm.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rafael@kernel.org \
    --cc=tglx@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

all inboxes | Powered by JetHome®