svn commit: r310436 - stable/11/sys/kern

John Baldwin jhb at FreeBSD.org
Fri Dec 23 00:38:45 UTC 2016


Author: jhb
Date: Fri Dec 23 00:38:43 2016
New Revision: 310436
URL: https://svnweb.freebsd.org/changeset/base/310436

Log:
  MFC 308948: 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.

Modified:
  stable/11/sys/kern/kern_clock.c
  stable/11/sys/kern/subr_param.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_clock.c
==============================================================================
--- stable/11/sys/kern/kern_clock.c	Thu Dec 22 23:59:53 2016	(r310435)
+++ stable/11/sys/kern/kern_clock.c	Fri Dec 23 00:38:43 2016	(r310436)
@@ -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: stable/11/sys/kern/subr_param.c
==============================================================================
--- stable/11/sys/kern/subr_param.c	Thu Dec 22 23:59:53 2016	(r310435)
+++ stable/11/sys/kern/subr_param.c	Fri Dec 23 00:38:43 2016	(r310436)
@@ -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-stable-11 mailing list