提交 7ded4291 编写于 作者: N Nicholas Piggin 提交者: Michael Ellerman

cpuidle: powerpc: no memory barrier after break from idle

A memory barrier is not required after the task wakes up,
only if we clear the polling flag before waking. The case
where we have work to do is the important one, so optimise
for it.
Reviewed-by: NVaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 624e46d0
...@@ -59,14 +59,21 @@ static int snooze_loop(struct cpuidle_device *dev, ...@@ -59,14 +59,21 @@ static int snooze_loop(struct cpuidle_device *dev,
ppc64_runlatch_off(); ppc64_runlatch_off();
HMT_very_low(); HMT_very_low();
while (!need_resched()) { while (!need_resched()) {
if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) {
/*
* Task has not woken up but we are exiting the polling
* loop anyway. Require a barrier after polling is
* cleared to order subsequent test of need_resched().
*/
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb();
break; break;
}
} }
HMT_medium(); HMT_medium();
ppc64_runlatch_on(); ppc64_runlatch_on();
clear_thread_flag(TIF_POLLING_NRFLAG); clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb();
return index; return index;
} }
......
...@@ -71,13 +71,20 @@ static int snooze_loop(struct cpuidle_device *dev, ...@@ -71,13 +71,20 @@ static int snooze_loop(struct cpuidle_device *dev,
while (!need_resched()) { while (!need_resched()) {
HMT_low(); HMT_low();
HMT_very_low(); HMT_very_low();
if (snooze_timeout_en && get_tb() > snooze_exit_time) if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) {
/*
* Task has not woken up but we are exiting the polling
* loop anyway. Require a barrier after polling is
* cleared to order subsequent test of need_resched().
*/
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb();
break; break;
}
} }
HMT_medium(); HMT_medium();
clear_thread_flag(TIF_POLLING_NRFLAG); clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb();
idle_loop_epilog(in_purr); idle_loop_epilog(in_purr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册