[PATCH] ppc64: SMT snooze fix in idle loop
Olof Johansson
olof at austin.ibm.com
Thu Mar 25 15:18:03 EST 2004
Hi,
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.
-Olof
Olof Johansson Office: 4F005/905
Linux on Power Development IBM Systems Group
Email: olof at austin.ibm.com Phone: 512-838-9858
All opinions are my own and not those of IBM
===== arch/ppc64/kernel/idle.c 1.20 vs edited =====
--- 1.20/arch/ppc64/kernel/idle.c Tue Mar 9 17:39:55 2004
+++ edited/arch/ppc64/kernel/idle.c Wed Mar 24 21:52:07 2004
@@ -175,16 +175,16 @@
oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
if (!oldval) {
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()) {
/* need_resched could be 1 or 0 at this
* point. If it is 0, set it to 0, so
* an IPI/Prod is sent. If it is 1, keep
* it that way & schedule work.
*/
- if (__get_tb() <
- (start_snooze +
- naca->smt_snooze_delay*tb_ticks_per_usec)) {
+ if (naca->smt_snooze_delay == 0 ||
+ __get_tb() < start_snooze) {
HMT_low(); /* Low thread priority */
continue;
}
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list