summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-11-12 22:27:46 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-11-12 22:27:46 +0000
commit43930bcf849c323d2a519206406b4834d43bca8f (patch)
tree3077ed3c474c1454c54e430526402cea46217d7d /sys
parentd651b3eeb1a48f8a8c07c385927cb442383fae1f (diff)
take a few more ticks to actually throttle down. hopefully helps in
situations where e.g. web browsing is cpu intense but intermittently idle. subject to further refinement and tuning.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/sched_bsd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index aa559208108..113b3017dd0 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.38 2014/11/03 03:08:00 deraadt Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.39 2014/11/12 22:27:45 tedu Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -586,6 +586,7 @@ void
setperf_auto(void *v)
{
static uint64_t *idleticks, *totalticks;
+ static int downbeats;
int i, j;
int speedup;
@@ -628,11 +629,13 @@ setperf_auto(void *v)
}
if (allidle < alltotal / 2)
speedup = 1;
+ if (speedup)
+ downbeats = 5;
if (speedup && perflevel != 100) {
perflevel = 100;
cpu_setperf(perflevel);
- } else if (!speedup && perflevel != 0) {
+ } else if (!speedup && perflevel != 0 && --downbeats <= 0) {
perflevel = 0;
cpu_setperf(perflevel);
}