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
This commit is contained in:
Mark Johnston 2016-05-18 03:55:54 +00:00
parent d2f5f8db87
commit ef89d843d9

View File

@ -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)))