Skip to content

Commit d4a7882

Browse files
ZhongqiuHan-Qcomrafaeljw
authored andcommitted
cpuidle: menu: Optimize bucket assignment when next_timer_ns equals KTIME_MAX
Directly assign the last bucket value instead of calling which_bucket() when next_timer_ns equals KTIME_MAX, the largest possible value that always falls into the last bucket. This avoids unnecessary calculations and enhances performance. Reviewed-by: Christian Loehle <[email protected]> Signed-off-by: Zhongqiu Han <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 194c396 commit d4a7882

File tree

1 file changed

+1
-1
lines changed
  • drivers/cpuidle/governors

1 file changed

+1
-1
lines changed

drivers/cpuidle/governors/menu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
255255
*/
256256
data->next_timer_ns = KTIME_MAX;
257257
delta_tick = TICK_NSEC / 2;
258-
data->bucket = which_bucket(KTIME_MAX);
258+
data->bucket = BUCKETS - 1;
259259
}
260260

261261
if (unlikely(drv->state_count <= 1 || latency_req == 0) ||

0 commit comments

Comments
 (0)