Once more: How to permanently change cpu governor?

I found several existing threads with a similar subject, but they seem to be outdated:

I tried adding cpufreq.default_governor=performance via yast2 → Bootloader → Kernel-Parameters, but that did not work either.

So what is the current way to change the cpu governor automatically during boot?

Background

I am on a fresh install of Tumbleweed, using an i7-13700K with Hyperthreading disabled in BIOS. I am compiling a lot of Haskell and my ear, my clock and htop confirm that the default boot yields a very limited performance (htop show no more than 3GHz, desipite a load average above 20) .

The following two commands issued as root fixes this successfully, htop showing 5.3GHz for the first eight cores and also largely reduced Haskell compile times:

# cpupower -c 0-7 frequency-set -d 800000 -u 5300000 -g performance
# cpupower -c 8-15 frequency-set -d 800000 -u 4200000 -g performance

and here is what I get after booting

# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences 
default performance balance_performance balance_power power 

# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference 
balance_performance

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors 
performance powersave

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
powersave

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 
5300000
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 
<unsupported>
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 
intel_pstate

@STurtle Hi I use the following to set schedutil on a Celeron N5095, should work for performance as well added to grub options;

intel_pstate=passive intel_pstate=no_hwp cpufreq.default_governor=schedutil msr

Perhaps intel_cpufreq (ondemand performance schedutil) vs intel_pstate (performance powersave)

Ref: https://www.kernel.org/doc/html/v5.0/admin-guide/pm/intel_pstate.html

Before;

# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences 
default performance balance_performance balance_power power 
# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference 
balance_performance
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
2900000
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 
<unsupported>
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
intel_pstate

After;

# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences
cat: /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences: No such file or directory
# cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference
cat: /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference: No such file or directory
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance schedutil 
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
schedutil
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
2900000
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
intel_cpufreq

Thanks that worked! :slightly_smiling_face:

Also, I found another, simpler solution: In KDE’s tray is a power setting. Moving the slider to performance also enable full speed. Duh. :face_with_open_eyes_and_hand_over_mouth:

@STurtle The new schedutil governor should switch to the correct setting when needed, else performance will have it running full speed all the time?

No, even though I moved the KDE energy profile to “Performance”, the cores are all at 800Mhz while I type this reply (according to htop). However, as soon as I start something that requires CPU power, such as compiling, the speeds go up quickly to the maximum. So it works the way I want it now.

I guess this is due to “intel_pstate” working in non-standard ways.

I am reluctant to disable the intel_pstate, since the CPU has different core types and I fear that another manager might assign the important tasks to the weak cores.

Also, I now see speeds of 5.4 GHz reported, which is above the 5.3 GHz reported by /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq. According to the CPU’s docs, this speed is only available for short bursts.

Interestingly enough, despite getting much more power in practice, I still see

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 
powersave