summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-12-15 20:38:22 +0000
committertedu <tedu@openbsd.org>2014-12-15 20:38:22 +0000
commit16af66b18a2ea3e42f9256168052a7cd8b906c89 (patch)
tree53c68b44738c1979a787cd220e537f9ea95002f1
parent.Xr cut which may be what you're really looking for. (diff)
downloadwireguard-openbsd-16af66b18a2ea3e42f9256168052a7cd8b906c89.tar.xz
wireguard-openbsd-16af66b18a2ea3e42f9256168052a7cd8b906c89.zip
don't drop the kernel lock everytime. on a busy system, this results in
the reaper spending more than half its time in uvm_pause. we want the system to be interactive, but we want throughput too. this seems like a decent balance.
-rw-r--r--sys/uvm/uvm_glue.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c
index 7a9618aa496..9eff05e49e9 100644
--- a/sys/uvm/uvm_glue.c
+++ b/sys/uvm/uvm_glue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_glue.c,v 1.68 2014/12/05 04:12:48 uebayasi Exp $ */
+/* $OpenBSD: uvm_glue.c,v 1.69 2014/12/15 20:38:22 tedu Exp $ */
/* $NetBSD: uvm_glue.c,v 1.44 2001/02/06 19:54:44 eeh Exp $ */
/*
@@ -467,8 +467,12 @@ uvm_atopg(vaddr_t kva)
void
uvm_pause(void)
{
- KERNEL_UNLOCK();
- KERNEL_LOCK();
+ static unsigned int toggle;
+ if (toggle++ > 128) {
+ toggle = 0;
+ KERNEL_UNLOCK();
+ KERNEL_LOCK();
+ }
if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD)
preempt(NULL);
}