summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsolene <solene@openbsd.org>2020-05-30 14:42:59 +0000
committersolene <solene@openbsd.org>2020-05-30 14:42:59 +0000
commita4278b797009c79db9ec0c880a475c0b787348b2 (patch)
treefd3bb324bd6da6a7b4aa64b24f6c9e89b0fd0f34
parentIntroduce kqueue_terminate() & kqueue_free(), no functional changes. (diff)
downloadwireguard-openbsd-a4278b797009c79db9ec0c880a475c0b787348b2.tar.xz
wireguard-openbsd-a4278b797009c79db9ec0c880a475c0b787348b2.zip
In automatic performance mode on systems with offline CPUs because of SMT
mitigation the algorithm was still accounting the offline CPUs, leading to a code path that would never be reached. This should allow better frequency scaling on systems with many CPUs. The frequency should scale up if one of two condition is true. - if at least one CPU has less than 25% of idle cpu time - if the average of all idle time is under 33% The second condition was never met because offline CPU are always accounted as 100% idle. A bit more explanations about the auto scaling in case someone want to improve this later: When one condition is met, CPU frequency is set to maximum and a counter set to 5, then the function will be run again 100ms later and decrement the counter if both conditions are not met anymore. Once the counter reach 0 the frequency is set to minimum. This mean that it can take up to 100ms to scale up and up to 500ms to scale down. ok brynet@ looks good tedu@
-rw-r--r--sys/kern/sched_bsd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 7806cc42c6b..888197d5fc1 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.62 2020/01/30 08:51:27 mpi Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.63 2020/05/30 14:42:59 solene Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -576,6 +576,8 @@ setperf_auto(void *v)
j = 0;
speedup = 0;
CPU_INFO_FOREACH(cii, ci) {
+ if (!cpu_is_online(ci))
+ continue;
total = 0;
for (i = 0; i < CPUSTATES; i++) {
total += ci->ci_schedstate.spc_cp_time[i];