[PATCH][PPC32] Optimize/fix timer_interrupt loop

From: Matt Porter
Date: Mon Aug 09 2004 - 10:21:19 EST


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.

Signed-off-by: Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx>

===== arch/ppc/kernel/time.c 1.29 vs edited =====
--- 1.29/arch/ppc/kernel/time.c Tue Jun 22 12:05:08 2004
+++ edited/arch/ppc/kernel/time.c Tue Aug 3 13:32:22 2004
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/