Guix: How to Change Your Default CPU Frequency Governor

There are I believe a few ways to do this, but I think this is the simplest: Simply insert the following code, nested in your operating-system declaration:

  (kernel-arguments (cons "cpufreq.default_governor=conservative" %default-kernel-arguments))

Replace “conservative” with the governor you want. The same code in an example operating-system declaration:

  (locale "en_US.utf8")
  (timezone "America/Anchorage")
    (keyboard-layout "us" "altgr-intl"))
      (bootloader grub-bootloader)
      (target "/dev/sda")
      (keyboard-layout keyboard-layout)))
  (kernel-arguments (cons "cpufreq.default_governor=conservative" %default-kernel-arguments))

From what I was told (on IRC) this method will only work with linux kernel release 5.9 or later, which was only added to the Guix main repository five days ago. So you might need to run a guix pull first if you haven’t update Guix in a while. The newer kernel has a feature to allow you to pass in the default governor as a boot parameter, rather than having to recompile the kernel.

(As a side note, today’s commits of the Guix master repository have a broken gdm login manager so I actually used commit b618c15 from five days ago to test the feature being highlighted in this blog post.)

The cpupower command will give you a list of governors available for your system. I would recommend “ondemand” for most users, as that lowers your cpu frequency when the system is running at lower loads, saving you electricity and heat. However, I prefer “conservative”, which is the same, but waits a little longer before bumping up the frequency, so as to not overreact to quick load spikes. “Powersave”, I believe, keeps you running always at the lowest frequency, while “performance” keeps you running always at the highest frequency.

christopher@nightshade ~$ sudo cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 4.0 us
  hardware limits: 800 MHz - 3.30 GHz
  available frequency steps:  3.30 GHz, 2.60 GHz, 2.10 GHz, 800 MHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 800 MHz and 3.30 GHz.
                  The governor "conservative" may decide which speed to use
                  within this range.
  current CPU frequency: 800 MHz (asserted by call to hardware)
  boost state support:
    Supported: no
    Active: no
    Boost States: 0
    Total States: 4
    Pstate-P0:  3300MHz
    Pstate-P1:  2600MHz
    Pstate-P2:  2100MHz
    Pstate-P3:  800MHz

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s