From: "Lorenz (xha)" Subject: Re: powersave CPU policy To: "Kirill A. Korinsky" Cc: OpenBSD tech Date: Sun, 5 May 2024 07:09:47 +0200 didn't actually review the diff completly, but maby more content in the manual page would be useful. anyways, small comment inline. On Sat, May 04, 2024 at 09:35:35PM +0200, Kirill A. Korinsky wrote: > @@ -583,7 +591,9 @@ int perfpolicy = PERFPOL_AUTO; > #include > > void setperf_auto(void *); > +void setperf_powersaving(void *); > struct timeout setperf_to = TIMEOUT_INITIALIZER(setperf_auto, NULL); > +struct timeout setperf_to_powersaving = TIMEOUT_INITIALIZER(setperf_powersaving, NULL); > extern int hw_power; > > void > @@ -653,6 +663,106 @@ faster: > timeout_add_msec(&setperf_to, 100); > } > > +void > +setperf_powersaving(void *v) > +{ > + static uint64_t *idleticks, *totalticks; > + static int downbeats; > + int i, j = 0; > + int speedup = 0; > + CPU_INFO_ITERATOR cii; > + struct cpu_info *ci, *firstoffline = NULL, *lastidle = NULL; > + uint64_t idle, total, allidle = 0, alltotal = 0; > + > + if (perfpolicy != PERFPOL_POWERSAVING) > + goto recover; > + > + if (cpu_setperf == NULL) > + goto recover; > + > + if (hw_power) > + goto recover; does the above check inforce some invariants? if not, could it be removed? this could be useful for servers to use less power, even if they're always running on AC.