summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-05-25 18:11:10 +0000
committermpi <mpi@openbsd.org>2019-05-25 18:11:10 +0000
commitffa74332a4c46f7f634bd839d9ae8924c82bdeb5 (patch)
tree55c212a56cd9f7b1bf152328fdc7f2bc8dee7e81
parentAdd <, >, <=, >= for formats, GitHub issue 1747. (diff)
downloadwireguard-openbsd-ffa74332a4c46f7f634bd839d9ae8924c82bdeb5.tar.xz
wireguard-openbsd-ffa74332a4c46f7f634bd839d9ae8924c82bdeb5.zip
Do not account spinning time as running time when a thread crosses a
tick boundary of schedlock(). This reduces the contention on the SCHED_LOCK() when the current thread is already spinning. Prompted by deraadt@, ok visa@
-rw-r--r--sys/kern/sched_bsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 00a08861b59..95c3bc23ef0 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.50 2019/02/26 14:24:21 visa Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.51 2019/05/25 18:11:10 mpi Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -542,7 +542,7 @@ schedclock(struct proc *p)
struct schedstate_percpu *spc = &ci->ci_schedstate;
int s;
- if (p == spc->spc_idleproc)
+ if (p == spc->spc_idleproc || spc->spc_spinning)
return;
SCHED_LOCK(s);