Index: sys/kern/kern_clock.c =================================================================== --- sys/kern/kern_clock.c (revision 222069) +++ sys/kern/kern_clock.c (working copy) @@ -440,10 +440,12 @@ flags |= TDF_PROFPEND | TDF_ASTPENDING; PROC_SUNLOCK(p); } - thread_lock(td); sched_tick(1); - td->td_flags |= flags; - thread_unlock(td); + if (flags != 0) { + thread_lock(td); + td->td_flags |= flags; + thread_unlock(td); + } #ifdef HWPMC_HOOKS if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) @@ -528,10 +530,12 @@ flags |= TDF_PROFPEND | TDF_ASTPENDING; PROC_SUNLOCK(p); } - thread_lock(td); sched_tick(cnt); - td->td_flags |= flags; - thread_unlock(td); + if (flags != 0) { + thread_lock(td); + td->td_flags |= flags; + thread_unlock(td); + } #ifdef HWPMC_HOOKS if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid)))