From ef89d843d953223a1a506f44c5b45c0c9304a4c3 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 18 May 2016 03:55:54 +0000 Subject: [PATCH] Do not acquire the thread lock in hardclock_cnt() unless needed. This function only sets thread flags if a SIGPROF or SIGVTALRM timer has fired, which is almost never the case. MFC after: 2 weeks --- sys/kern/kern_clock.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 17b85bcfdacc..e7a7a990703e 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -570,9 +570,11 @@ hardclock_cnt(int cnt, int usermode) flags |= TDF_PROFPEND | TDF_ASTPENDING; PROC_ITIMUNLOCK(p); } - thread_lock(td); - 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)))