From: Anton Blanchard Date: Mon, 3 Apr 2017 21:54:14 +0000 (+1000) Subject: cpuidle: powernv: Avoid a branch in the core snooze_loop() loop X-Git-Tag: v4.12-rc6~35^2^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0baa91cb73e296242edad89cfe3f60c59ab8a95a;p=platform%2Fkernel%2Flinux-exynos.git cpuidle: powernv: Avoid a branch in the core snooze_loop() loop When in the snooze_loop() we want to take up the least amount of resources. On my version of gcc (6.3), we end up with an extra branch because it predicts snooze_timeout_en to be false, whereas it is almost always true. Use likely() to avoid the branch and be a little nicer to the other non idle threads on the core. Signed-off-by: Anton Blanchard Reviewed-by: Vaidyanathan Srinivasan Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index f890167..5bb4bb3 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -58,7 +58,7 @@ static int snooze_loop(struct cpuidle_device *dev, ppc64_runlatch_off(); HMT_very_low(); while (!need_resched()) { - if (snooze_timeout_en && get_tb() > snooze_exit_time) + if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) break; }