drivers/cpuidle/governors/menu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
When idle state 0 is disabled and the PM QoS latency constraint is
zero (latency_req == 0), the first branch of the || in the early-return
condition of menu_select() is taken immediately, so state 0 is returned
regardless of its disable flag.
Address this by making the !disable check a prerequisite for the entire
early-return condition, so that when state 0 is disabled the normal
state selection loop is used instead, which already skips disabled
states.
Fixes: 53812cdc9100 ("cpuidle: menu: Move the latency_req == 0 special case check")
Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
---
drivers/cpuidle/governors/menu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 544a5d593007..eb529d73d4b7 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -284,10 +284,10 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
data->bucket = BUCKETS - 1;
}
- if (latency_req == 0 ||
- ((data->next_timer_ns < drv->states[1].target_residency_ns ||
- latency_req < drv->states[1].exit_latency_ns) &&
- !dev->states_usage[0].disable)) {
+ if (!dev->states_usage[0].disable &&
+ (latency_req == 0 ||
+ data->next_timer_ns < drv->states[1].target_residency_ns ||
+ latency_req < drv->states[1].exit_latency_ns)) {
/*
* In this case state[0] will be used no matter what, so return
* it right away and keep the tick running if state[0] is a
--
2.43.0
On Thu, Aug 27, 2026 at 11:48 AM Xueqin Luo <luoxueqin@kylinos.cn> wrote:
>
> When idle state 0 is disabled and the PM QoS latency constraint is
> zero (latency_req == 0), the first branch of the || in the early-return
> condition of menu_select() is taken immediately, so state 0 is returned
> regardless of its disable flag.
>
> Address this by making the !disable check a prerequisite for the entire
> early-return condition, so that when state 0 is disabled the normal
> state selection loop is used instead, which already skips disabled
> states.
>
> Fixes: 53812cdc9100 ("cpuidle: menu: Move the latency_req == 0 special case check")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
> drivers/cpuidle/governors/menu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 544a5d593007..eb529d73d4b7 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -284,10 +284,10 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
> data->bucket = BUCKETS - 1;
> }
>
> - if (latency_req == 0 ||
> - ((data->next_timer_ns < drv->states[1].target_residency_ns ||
> - latency_req < drv->states[1].exit_latency_ns) &&
> - !dev->states_usage[0].disable)) {
> + if (!dev->states_usage[0].disable &&
> + (latency_req == 0 ||
> + data->next_timer_ns < drv->states[1].target_residency_ns ||
> + latency_req < drv->states[1].exit_latency_ns)) {
> /*
> * In this case state[0] will be used no matter what, so return
> * it right away and keep the tick running if state[0] is a
> --
Applied as 7.4 material, thanks!
© 2016 - 2026 Red Hat, Inc.