diff options
author | Anton Blanchard <anton@samba.org> | 2017-04-03 17:54:14 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-04-19 17:17:19 -0400 |
commit | 0baa91cb73e296242edad89cfe3f60c59ab8a95a (patch) | |
tree | 9e5250def7c919e0a8ad2763d7707a3dfc42bd7d | |
parent | 26eb48a9faf241abd60aa546e6beb896011667c1 (diff) |
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 <anton@samba.org>
Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpuidle/cpuidle-powernv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index f8901671fff4..5bb4bb303fba 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, | |||
58 | ppc64_runlatch_off(); | 58 | ppc64_runlatch_off(); |
59 | HMT_very_low(); | 59 | HMT_very_low(); |
60 | while (!need_resched()) { | 60 | while (!need_resched()) { |
61 | if (snooze_timeout_en && get_tb() > snooze_exit_time) | 61 | if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) |
62 | break; | 62 | break; |
63 | } | 63 | } |
64 | 64 | ||