From: Jeremie Courreges-Anglas Subject: Re: apmd: adapt to changes in hw.perfpolicy sysctl To: "Thomas L." Cc: tech@openbsd.org Date: Fri, 10 Jan 2025 18:13:24 +0100 On Fri, Jan 10, 2025 at 11:59:48AM +0100, Thomas L. wrote: > hi, > > i had noticed my laptop performing worse and finally found out that this is > related to the change of the hw.perfpolicy sysctl. i had apmd_flags=-A in my > rc.conf.local and on startup this calls setperfpolicy("auto"). this sets the > hw.perfpolicy sysctl to auto, which previously meant the current default of > high,auto but now means auto,auto resulting in slowdowns even when running > pluged-in. the patch below restores the old behaviour. > > kind regards, Thanks for bringing this up, though I strongly doubt that this is the proper way to address your concern. apmd(8) either needs to forget about those perfpolicy concerns, or it needs to know more about it than your diff provides. To get the default behavior of the kernel since 2021, which is effectively "high,auto", you can just stop using apmd's -A flag. > thomas > > diff --git usr.sbin/apmd/apmd.c usr.sbin/apmd/apmd.c > index f29d5c9a081..8ddb2505b68 100644 > --- usr.sbin/apmd/apmd.c > +++ usr.sbin/apmd/apmd.c > @@ -674,6 +674,8 @@ setperfpolicy(char *policy) > } else if (strcmp(policy, "high") == 0) { > policy = "manual"; > new_perf = 100; > + } else if (strcmp(policy, "auto") == 0) { > + policy = "high,auto"; > } > > if (sysctl(hw_perfpol_mib, 2, NULL, NULL, > -- jca