Skip to contentSkip to conversation

Optimize/fix timer_interrupt loop

PATCH New Matt Porter 1 participant 1 message Aug 9, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Optimize/fix timer_interrupt loop

The following patch fixes the situation where the loop condition could generate a next_dec of zero while exiting the loop. This is suboptimal on Classic PPC because it forces another interrupt to occur and reenter the handler. It is fatal on Book E cores, because their decrementer is stopped when writing a zero (Classic interrupts on a 0->-1 transition, Book E interrupts on a 1->0 transition). Instead, stay in the loop on a next_dec==0.

===== arch/ppc/kernel/time.c 1.29 vs edited =====

arch/ppc/kernel/time.c +1 -1
@@ -161,7 +161,7 @@
 
 	irq_enter();
 
-	while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) < 0) {
+	while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) {
 		jiffy_stamp += tb_ticks_per_jiffy;
 		
 		ppc_do_profile(regs);