[PATCH 1/4] tickless idle cpu - Allow any CPU to update jiffies

Srivatsa Vaddagiri vatsa at in.ibm.com
Fri Apr 7 16:30:44 EST 2006


Currently, only boot CPU calls do_timer to update jiffies. This prevents
idle boot CPU from skipping ticks. Patch below, against 2.6.17-rc1-mm1,
allows jiffies to be updated from any CPU.

Signed-off-by: Srivatsa Vaddagiri <vatsa at in.ibm.com>

---

 linux-2.6.17-rc1-root/arch/powerpc/kernel/time.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff -puN arch/powerpc/kernel/time.c~boot_cpu_fix arch/powerpc/kernel/time.c
--- linux-2.6.17-rc1/arch/powerpc/kernel/time.c~boot_cpu_fix	2006-04-07 04:13:53.000000000 +0530
+++ linux-2.6.17-rc1-root/arch/powerpc/kernel/time.c	2006-04-07 04:14:03.000000000 +0530
@@ -685,19 +685,17 @@ void timer_interrupt(struct pt_regs * re
 		if (!cpu_is_offline(cpu))
 			account_process_time(regs);
 
-		/*
-		 * No need to check whether cpu is offline here; boot_cpuid
-		 * should have been fixed up by now.
-		 */
-		if (cpu != boot_cpuid)
-			continue;
-
 		write_seqlock(&xtime_lock);
-		tb_last_jiffy += tb_ticks_per_jiffy;
-		tb_last_stamp = per_cpu(last_jiffy, cpu);
-		do_timer(regs);
-		timer_recalc_offset(tb_last_jiffy);
-		timer_check_rtc();
+		if (tb_ticks_since(tb_last_stamp) >= tb_ticks_per_jiffy) {
+			tb_last_jiffy += tb_ticks_per_jiffy;
+			tb_last_stamp += tb_ticks_per_jiffy;
+			/* Handle RTCL overflow on 601 */
+			if (__USE_RTC() && tb_last_stamp >= 1000000000)
+				tb_last_stamp -= 1000000000;
+			do_timer(regs);
+			timer_recalc_offset(tb_last_jiffy);
+			timer_check_rtc();
+		}
 		write_sequnlock(&xtime_lock);
 	}
 	

_
-- 
Regards,
vatsa



More information about the Linuxppc-dev mailing list