lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0h2iu9V4DiW8XSmEykw-w7dowdc_=4H2w6OrbBYn1wRWQ@mail.gmail.com>
Date: Fri, 9 Jan 2026 21:54:07 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH] cpuidle: menu: Remove incorrect unlikely() annotation

On Mon, Jan 5, 2026 at 3:38 PM Breno Leitao <leitao@...ian.org> wrote:
>
> The unlikely() annotation on the early-return condition in menu_select()
> is incorrect on systems with only one idle state (e.g., ARM64 servers
> with a single ACPI LPI state). Branch profiling shows 100% misprediction
> on such systems since drv->state_count <= 1 is always true.
>
> On platforms where only state0 is available, this path is the common
> case, not an unlikely edge case. Remove the misleading annotation to
> let the branch predictor learn the actual behavior.
>
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
>  drivers/cpuidle/governors/menu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 64d6f7a1c776..ef9c5a84643e 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -271,7 +271,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>                 data->bucket = BUCKETS - 1;
>         }
>
> -       if (unlikely(drv->state_count <= 1 || latency_req == 0) ||
> +       if (drv->state_count <= 1 || 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)) {
>
> ---

Applied as 6.20 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ