Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2014 18:37:46 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264550 - head/sys/kern
Message-ID:  <201404161837.s3GIbkuS075901@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Apr 16 18:37:46 2014
New Revision: 264550
URL: http://svnweb.freebsd.org/changeset/base/264550

Log:
  Fix VIRTUAL and PROF interval timers for short intervals, broken at r247903.
  
  Due to the way those timers are implemented, we can't handle very short
  intervals.  In addition to that mentioned patch caused math overflows
  for short intervals.  To avoid that round those intervals to 1 tick.
  
  PR:		kern/187668
  MFC after:	1 week

Modified:
  head/sys/kern/kern_time.c

Modified: head/sys/kern/kern_time.c
==============================================================================
--- head/sys/kern/kern_time.c	Wed Apr 16 18:23:36 2014	(r264549)
+++ head/sys/kern/kern_time.c	Wed Apr 16 18:37:46 2014	(r264550)
@@ -774,6 +774,14 @@ kern_setitimer(struct thread *td, u_int 
 				timevalsub(&oitv->it_value, &ctv);
 		}
 	} else {
+		if (aitv->it_interval.tv_sec == 0 &&
+		    aitv->it_interval.tv_usec != 0 &&
+		    aitv->it_interval.tv_usec < tick)
+			aitv->it_interval.tv_usec = tick;
+		if (aitv->it_value.tv_sec == 0 &&
+		    aitv->it_value.tv_usec != 0 &&
+		    aitv->it_value.tv_usec < tick)
+			aitv->it_value.tv_usec = tick;
 		PROC_SLOCK(p);
 		*oitv = p->p_stats->p_timer[which];
 		p->p_stats->p_timer[which] = *aitv;



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