Commit b0887c1c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: SMT snooze fix in idle loop

From: Olof Johansson <olof@austin.ibm.com>

A smt_snooze_delay of 0 is supposed to mean "disabled", but current idle
loop logic doesn't take that into account and snoozes immediately instead.

Below patch fixes the logic in the idle loop, as well as cleans up the test
a bit.  An idling processor might no longer see a snooze change
immediately, but that's not needed anyway.
parent 0e062700
...@@ -172,16 +172,16 @@ int dedicated_idle(void) ...@@ -172,16 +172,16 @@ int dedicated_idle(void)
oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
if (!oldval) { if (!oldval) {
set_thread_flag(TIF_POLLING_NRFLAG); set_thread_flag(TIF_POLLING_NRFLAG);
start_snooze = __get_tb(); start_snooze = __get_tb() +
naca->smt_snooze_delay*tb_ticks_per_usec;
while (!need_resched()) { while (!need_resched()) {
/* need_resched could be 1 or 0 at this /* need_resched could be 1 or 0 at this
* point. If it is 0, set it to 0, so * point. If it is 0, set it to 0, so
* an IPI/Prod is sent. If it is 1, keep * an IPI/Prod is sent. If it is 1, keep
* it that way & schedule work. * it that way & schedule work.
*/ */
if (__get_tb() < if (naca->smt_snooze_delay == 0 ||
(start_snooze + __get_tb() < start_snooze) {
naca->smt_snooze_delay*tb_ticks_per_usec)) {
HMT_low(); /* Low thread priority */ HMT_low(); /* Low thread priority */
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment