From: solene Date: Tue, 10 May 2022 22:18:06 +0000 (+0000) Subject: make the CPU frequency scaling duration relative to the load X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=be93862e1464f552e5079fcd3af626e6cfad4b93;p=openbsd make the CPU frequency scaling duration relative to the load in the pre-change behavior, if the CPU frequency is raised, it will stay up for 5 cycles minimum (with one cycle being run every 100ms). With this change, the time to keep the frequency raised is incremented at each cycle up to 5. This mean short load need triggering the frequency increase will last less than the current minimum of 500ms. this only affect the automatic mode when on battery, extending the battery life for most interactive use scenarios and idling loads. tested by many with good results ok ketennis@ --- diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index 49295484fb0..7419b26c6f2 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.70 2021/10/30 23:24:48 deraadt Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.71 2022/05/10 22:18:06 solene Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -579,8 +579,8 @@ setperf_auto(void *v) } if (allidle < alltotal / 2) speedup = 1; - if (speedup) - downbeats = 5; + if (speedup && downbeats < 5) + downbeats++; if (speedup && perflevel != 100) { faster: