Skip to content

Commit

Permalink
cpuidle: powernv: Avoid a branch in the core snooze_loop() loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Blanchard authored and Rafael J. Wysocki committed Apr 19, 2017
1 parent 26eb48a commit 0baa91c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/cpuidle/cpuidle-powernv.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 0baa91c

Please sign in to comment.