summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2016-05-18 03:55:54 +0000
committermarkj <markj@FreeBSD.org>2016-05-18 03:55:54 +0000
commite3564c4833de91d62f7f7ede64ceed2471ba19b5 (patch)
treed801753c86ba8102960ebe09dbdd06fe1d2687a6 /sys/kern/kern_clock.c
parentd82dbf711e9365247fa8a848625ca9a761ad62ba (diff)
downloadFreeBSD-src-e3564c4833de91d62f7f7ede64ceed2471ba19b5.zip
FreeBSD-src-e3564c4833de91d62f7f7ede64ceed2471ba19b5.tar.gz
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
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r--sys/kern/kern_clock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 17b85bc..e7a7a99 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)))
OpenPOWER on IntegriCloud