Sane cpu frequency governor selection on NixOS

Currently the default kernel build sets CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y, then nixos-generate-config.pl overrides this with its own defaults (that is ondemand or powersave).

Is there a reason we don’t just use the upstream kernel defaults?
On e.g. 5.7 upstream will default to schedutil on newer intel platforms. I don’t quite get why we have this convoluted dance of overriding defaults.

The current setting dates back to 2015. Maybe this should be revised, such that the governor is no longer defined automatically anywhere in nixpkgs, that is:

  • common-config.nix no longer defines a default for the option
  • nixos-generate-config no longer generates a cpufreq governor setting
  • the NixOS option defaults to null

However, it’s not entirely clear to me if that will result in sensible behaviour after reading linux/Documentation/admin-guide/pm/cpufreq.rst — which doesn’t mention what the default is. While the commit you mentioned does update the default for the config option definition, the current x86_64 defconfig (linux/arch/x86/configs/x86_64_defconfig) suggests that it will default to the userspace governor, which is no more sensible than performance IMHO.