Commit d557640e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

sched: idle: Make skipping governor callbacks more consistent



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: e5c9ffc6 ("cpuidle: Skip governor when only one idle state is available")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarChristian Loehle <christian.loehle@arm.com>
Reviewed-by: default avatarAboorva Devarajan <aboorvad@linux.ibm.com>
Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Link: https://patch.msgid.link/12857700.O9o76ZdvQC@rafael.j.wysocki
parent 1f318b96
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -359,16 +359,6 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
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);
}

+10 −1
Original line number Diff line number Diff line
@@ -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: