svn commit: r308948 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Nov 22 01:03:01 UTC 2016


Author: jhb
Date: Tue Nov 22 01:02:59 2016
New Revision: 308948
URL: https://svnweb.freebsd.org/changeset/base/308948

Log:
  Initialize 'ticks' earlier in boot after 'hz' is set.
  
  This avoids the time-warp after kthreads have started running and the
  required fixup to td_slptick and td_blktick in the EARLY_AP_STARTUP
  case.  Now, 'ticks' is initialized before any kthreads are created or
  any context switches are performed.
  
  Tested by:	gavin
  MFC after:	2 weeks
  Sponsored by:	Netflix

Modified:
  head/sys/kern/kern_clock.c
  head/sys/kern/subr_param.c

Modified: head/sys/kern/kern_clock.c
==============================================================================
--- head/sys/kern/kern_clock.c	Tue Nov 22 00:41:24 2016	(r308947)
+++ head/sys/kern/kern_clock.c	Tue Nov 22 01:02:59 2016	(r308948)
@@ -393,10 +393,6 @@ static void
 initclocks(dummy)
 	void *dummy;
 {
-#ifdef EARLY_AP_STARTUP
-	struct proc *p;
-	struct thread *td;
-#endif
 	register int i;
 
 	/*
@@ -416,40 +412,6 @@ initclocks(dummy)
 #ifdef SW_WATCHDOG
 	EVENTHANDLER_REGISTER(watchdog_list, watchdog_config, NULL, 0);
 #endif
-	/*
-	 * Arrange for ticks to wrap 10 minutes after boot to help catch
-	 * sign problems sooner.
-	 */
-	ticks = INT_MAX - (hz * 10 * 60);
-
-#ifdef EARLY_AP_STARTUP
-	/*
-	 * Fixup the tick counts in any blocked or sleeping threads to
-	 * account for the jump above.
-	 */
-	sx_slock(&allproc_lock);
-	FOREACH_PROC_IN_SYSTEM(p) {
-		PROC_LOCK(p);
-		if (p->p_state == PRS_NEW) {
-			PROC_UNLOCK(p);
-			continue;
-		}
-		FOREACH_THREAD_IN_PROC(p, td) {
-			thread_lock(td);
-			if (TD_ON_LOCK(td)) {
-				MPASS(td->td_blktick == 0);
-				td->td_blktick = ticks;
-			}
-			if (TD_ON_SLEEPQ(td)) {
-				MPASS(td->td_slptick == 0);
-				td->td_slptick = ticks;
-			}
-			thread_unlock(td);
-		}
-		PROC_UNLOCK(p);
-	}
-	sx_sunlock(&allproc_lock);
-#endif
 }
 
 /*

Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c	Tue Nov 22 00:41:24 2016	(r308947)
+++ head/sys/kern/subr_param.c	Tue Nov 22 01:02:59 2016	(r308948)
@@ -171,6 +171,12 @@ init_param1(void)
 	tick_sbt = SBT_1S / hz;
 	tick_bt = sbttobt(tick_sbt);
 
+	/*
+	 * Arrange for ticks to wrap 10 minutes after boot to help catch
+	 * sign problems sooner.
+	 */
+	ticks = INT_MAX - (hz * 10 * 60);
+
 #ifdef VM_SWZONE_SIZE_MAX
 	maxswzone = VM_SWZONE_SIZE_MAX;
 #endif


More information about the svn-src-all mailing list