]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cpuidle: menu: Remove incorrect unlikely() annotation
authorBreno Leitao <leitao@debian.org>
Mon, 5 Jan 2026 14:37:06 +0000 (06:37 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 9 Jan 2026 20:52:54 +0000 (21:52 +0100)
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@debian.org>
Link: https://patch.msgid.link/20260105-annotated_idle-v1-1-10ddf0771b58@debian.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/menu.c

index 64d6f7a1c7766325da05248b5e210a7dab4509d3..ef9c5a84643eed892c8710a641dc788797eb95f6 100644 (file)
@@ -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)) {