diff options
author | jhb <jhb@FreeBSD.org> | 2016-12-23 00:38:43 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-12-23 00:38:43 +0000 |
commit | f68221a306bea7ba6238d1394440f90e03da1416 (patch) | |
tree | 7241d769b17950e2df0c0afa0e9cd0fe82c56f8a | |
parent | a9e2239abaf45fc9b09a264a82af253bcb3785e2 (diff) | |
download | FreeBSD-src-f68221a306bea7ba6238d1394440f90e03da1416.zip FreeBSD-src-f68221a306bea7ba6238d1394440f90e03da1416.tar.gz |
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.
-rw-r--r-- | sys/kern/kern_clock.c | 38 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 6 |
2 files changed, 6 insertions, 38 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 39ffdb3..7734e81 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -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 } /* diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index e48072c..cbb38e1 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -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 |