Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Mar 2006 13:57:10 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Mike Jakubik <mikej@rogers.com>
Subject:   Re: Still seeing "calcru: runtime went backwards" messages
Message-ID:  <200603011357.12175.jhb@freebsd.org>
In-Reply-To: <4405E745.9040604@rogers.com>
References:  <4405E745.9040604@rogers.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 01 March 2006 13:26, Mike Jakubik wrote:
> FYI, I just did a fresh cvsup and buildworld yesterday night, and i am 
> still getting the clacru messages:
> 
> Mar  1 02:41:37 fbsd kernel: calcru: runtime went backwards from 32465 
> usec to 32464 usec for pid 490 (sh)
> Mar  1 02:41:37 fbsd kernel: u 0:0/0 s 1:32465/32464 i 0:0/0
> Mar  1 02:41:37 fbsd kernel: calcru: runtime went backwards from 17198 
> usec to 17197 usec for pid 318 (devd)
> Mar  1 02:41:37 fbsd kernel: u 0:0/0 s 2:17198/17197 i 0:0/0
> Mar  1 02:45:45 fbsd kernel: calcru: runtime went backwards from 3403872 
> usec to 3403870 usec for pid 722 (perl5.8.8)
> Mar  1 02:45:45 fbsd kernel: u 367:2852102/2852101 s 71:551769/551768 i 
> 0:1/1
> Mar  1 02:45:45 fbsd kernel: calcru: runtime went backwards from 5135265 
> usec to 5135263 usec for pid 1 (init)
> Mar  1 02:45:45 fbsd kernel: u 298:2383658/2383657 s 344:2751606/2751605 
> i 0:1/1

Try this fix for one.  It fixes the case that once time goes backward once
we keep using the last known time rather than using the new shorter time:

Index: kern_resource.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/kern_resource.c,v
retrieving revision 1.156
diff -u -r1.156 kern_resource.c
--- kern_resource.c	22 Feb 2006 16:58:48 -0000	1.156
+++ kern_resource.c	22 Feb 2006 17:00:38 -0000
@@ -761,14 +761,19 @@
 	ut = ruxp->rux_uticks;
 	st = ruxp->rux_sticks;
 	it = ruxp->rux_iticks;
-	tu = ruxp->rux_runtime;
-	tu = cputick2usec(tu);
 	tt = ut + st + it;
 	if (tt == 0) {
 		st = 1;
 		tt = 1;
 	}
+	tu = cputick2usec(ruxp->rux_runtime);
 	ptu = ruxp->rux_uu + ruxp->rux_su + ruxp->rux_iu;
+	if (tu < ptu) {
+		printf(
+"calcru: runtime went backwards from %ju usec to %ju usec for pid %d (%s)\n",
+		    (uintmax_t)ptu, (uintmax_t)tu, p->p_pid, p->p_comm);
+		tu = ptu;
+	}
 	if ((int64_t)tu < 0) {
 		printf("calcru: negative runtime of %jd usec for pid %d (%s)\n",
 		    (intmax_t)tu, p->p_pid, p->p_comm);
@@ -779,16 +784,6 @@
 	uu = (tu * ut) / tt;
 	su = (tu * st) / tt;
 	iu = tu - uu - su;
-	if (tu < ptu) {
-		printf(
-"calcru: runtime went backwards from %ju usec to %ju usec for pid %d (%s)\n",
-		    (uintmax_t)ptu, (uintmax_t)tu, p->p_pid, p->p_comm);
-		printf("u %ju:%ju/%ju s %ju:%ju/%ju i %ju:%ju/%ju\n",
-		    (uintmax_t)ut, (uintmax_t)ruxp->rux_uu, uu,
-		    (uintmax_t)st, (uintmax_t)ruxp->rux_su, su,
-		    (uintmax_t)it, (uintmax_t)ruxp->rux_iu, iu);
-		tu = ptu;
-	}
 #if 0
 	/* Enforce monotonicity. */
 	if (uu < ruxp->rux_uu || su < ruxp->rux_su || iu < ruxp->rux_iu) {

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603011357.12175.jhb>