Repository navigation
omarchy-mac: run the CPUs on the performance governor on AC - #33
joshuaswarren wants to merge 2 commits into
Conversation
Main is at 0.2.3 after omarchy-mac-pkgs#32, so this bumps to 0.2.4.
|
Opening for review. This draft waited on one design question: whether the AC/battery split should be the shipped default. It is settled. In the Omarchy M+ team chat on 2026-10-11 the answer was full power when plugged in and low power on battery, and the lab Macs have run The measurement behind the 13-inch row above (series of 2026-10-11, same boot and model, ANE idle, control spread 0.3 percent): gemma-4-E4B decode on a 13-inch M1 MacBook Pro read 10.65 tok/s under Checks at this head (b032099):
@maralcbr ready for your review whenever it fits. |
[Medium impact] The change affects CPU governor selection on Apple Silicon Macs using this package. The PR appears safe to merge, with a non-blocking correction needed in the opt-out instructions. Findings
SummaryAdds automatic CPU governor changes on Apple Silicon:
Acknowledged limits from joshuaswarren: the packaged cold-boot path, battery hardware, USB-C charging, battery draw, and interaction with Reviews (1) · Last reviewed commit: "Merge origin/main into feat/cpu-governor..." · Reviewed by Greptile |
|
|
||
| On AC the CPUs run the `performance` governor, and on battery they run `schedutil`, the kernel's default. The package's udev rule runs `/usr/lib/omarchy-mac/cpu-governor-policy` when the SMC AC supply (`macsmc-ac`) appears at boot and on each change of its `online` value. The helper sets every `cpufreq/policy*` that lists the governor, on Apple Silicon only, and otherwise leaves the governors alone. Nothing needs enabling. | ||
|
|
||
| `schedutil` can leave the CPU near its low clock while a GPU or Neural Engine job runs, which slows inference that waits on the CPU (measured numbers are in the pull request). Battery draw under `performance` is not measured. To keep `schedutil` on AC too, mask the rule: `sudo ln -s /dev/null /etc/udev/rules.d/95-omarchy-mac-cpu-governor.rules`. Anything that sets a governor by hand is overwritten at the next AC event. |
There was a problem hiding this comment.
Opt-out leaves performance enabled
Masking the rule does not restore schedutil if the helper has already selected performance. It also stops the unplug event from restoring it, so someone following this opt-out can stay on performance on battery until reboot. Tell users to reboot after masking, or include a command that restores schedutil immediately. The manual needs the same clarification.
Ready for review. The AC/battery split (performance on AC, schedutil on battery) is the agreed design; see the opening comment.
What changes
A udev rule runs a small helper when the SMC AC supply (
macsmc-ac) appears at boot and on each change of itsonlinevalue:cpufreq/policy*that listsperformancegetsperformance.schedutil, the kernel default.It adds
lib/cpu-governor-policy,vendor/udev/rules.d/95-omarchy-mac-cpu-governor.rulesandtest/cpu-governor-test.sh. The README, the manual hardware table andversion(0.2.3 to 0.2.4) change in the same commit. To keepschedutilon AC, mask the rule with a symlink to/dev/nullin/etc/udev/rules.d; the README and the manual say how.Why
On our lab Macs,
schedutilleaves the CPU near its low clock while the GPU or the Neural Engine runs a job. Inference that waits on the CPU then runs slower. A/B runs on the same kernel and the same model,schedutilas found againstperformance:Each row is one lab series; the measured receipt for the 13-inch row is in the opening comment.
Tested
test/allpasses (exit 0). The new test covers AC online and offline, an unknown value, a missing supply, a policy without the governor, and a non-Apple machine, all against a fixture sysfs.ACTION=changeandACTION=addonmacsmc-ac, withPOWER_SUPPLY_ONLINE=1. The helper wroteperformance, which was already set.CONFIG_ARM_APPLE_SOC_CPUFREQ=ythere, so the policies exist when udev coldplug runs.Not tested
performanceare not measured. Nothing here claims the battery side is cheap./usr/lib/udev/rules.d. The cold-boot path rests on the coldplugaddevent, which I ran by hand.macsmc-acreportsonlinethere.power-profiles-daemon. On one Mac the daemon runs with thebalancedandpower-saverprofiles and a placeholder driver that does not touchcpufreq, so it does not conflict. A profile change does not change the governor.