Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] How to Permanently Set Cpu to Performance? (Read 5894 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

[SOLVED] How to Permanently Set Cpu to Performance?

Im using the following command to set my cpu to performance mode, but they reset back to default after a reboot.

Code: [Select]
echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

How can I set it to performance permanently? Was reading the arch wiki but it seems like systemd related.
Im currently using artix base runit. Appologies if my question is stupid, first time linux user.

Re: How to Permanently Set Cpu to Performance?

Reply #1
If your init system supports rc.local, you can put this command in it
ARMtix


 

Re: How to Permanently Set Cpu to Performance?

Reply #4
read it again and thoroughly, please! ;-)

Sorry, but I don't think I quite understand what Im supposed to do. I tried

Code: [Select]
/etc/modprobe.d/myfilename.conf
options acpi_cpufreq cpufreq.default_governor=performance

as well as

Code: [Select]
/etc/udev/rules.d/50-scaling-governor.rules
SUBSYSTEM=="module", ACTION=="add", KERNEL=="acpi_cpufreq", RUN+="/bin/sh -c 'echo performance > /sys/devices/system/cpu/cpufreq/policy*/scaling_governor'"

and none of them seem to work.

Re: How to Permanently Set Cpu to Performance?

Reply #5
What have you for processor?
Put here log from lsmod

Re: How to Permanently Set Cpu to Performance?

Reply #6
since kernel 5.9 you can add to your boot manager parameter cpufreq.default_governor= performance
https://wiki.archlinux.org/index.php/kernel_parameters for more details, depends on your boot manager (grub/syslinux/etc.)

Quote
Allow to specify their CPUfreq governor of choice using the kernel command line (cpufreq.default_governor= parameter), instead of having to wait for the system to fully boot to userspace to switch using the sysfs interface
 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=10dd8573b09e84b81539d939d55ebdb6a36c5f3a


Re: How to Permanently Set Cpu to Performance?

Reply #7
since kernel 5.9 you can add to your boot manager parameter cpufreq.default_governor=performance

I added cpufreq.default_governor= performance in /etc/modprobe.d/myconfig.conf but that didn't work either.

Processor is 3700x and Im using grub as bootloader. Here's my lsmod.


Code: [Select]
lsmod
Module                  Size  Used by
rfkill                 28672  0
fuse                  139264  4
joydev                 28672  0
mousedev               24576  0
input_leds             16384  0
hid_generic            16384  0
usbhid                 65536  0
uas                    32768  0
usb_storage            81920  1 uas
hid                   147456  2 usbhid,hid_generic
nouveau              2351104  16
snd_hda_codec_realtek   143360  1
edac_mce_amd           32768  0
mxm_wmi                16384  1 nouveau
wmi_bmof               16384  0
snd_hda_codec_generic    98304  1 snd_hda_codec_realtek
i2c_algo_bit           16384  1 nouveau
ttm                   122880  1 nouveau
ledtrig_audio          16384  1 snd_hda_codec_generic
drm_kms_helper        266240  1 nouveau
snd_hda_codec_hdmi     73728  1
cec                    73728  1 drm_kms_helper
snd_hda_intel          57344  0
rc_core                61440  1 cec
snd_intel_dspcfg       24576  1 snd_hda_intel
drm                   585728  7 drm_kms_helper,ttm,nouveau
kvm                   851968  0
snd_hda_codec         167936  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_hda_core          106496  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
snd_hwdep              16384  1 snd_hda_codec
agpgart                53248  3 ttm,nouveau,drm
snd_pcm               147456  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
r8169                  98304  0
irqbypass              16384  1 kvm
syscopyarea            16384  1 drm_kms_helper
crct10dif_pclmul       16384  1
snd_timer              45056  1 snd_pcm
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
realtek                24576  1
aesni_intel           372736  0
mdio_devres            16384  1 r8169
snd                   114688  8 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm
of_mdio                24576  1 mdio_devres
crypto_simd            16384  1 aesni_intel
fixed_phy              16384  1 of_mdio
sysfillrect            16384  1 drm_kms_helper
cryptd                 24576  2 crypto_simd,ghash_clmulni_intel
sp5100_tco             20480  0
glue_helper            16384  1 aesni_intel
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
ccp                   118784  0
libphy                151552  5 r8169,mdio_devres,of_mdio,realtek,fixed_phy
soundcore              16384  1 snd
i2c_piix4              28672  0
k10temp                16384  0
rapl                   16384  0
pcspkr                 16384  0
rng_core               16384  1 ccp
evdev                  28672  17
pinctrl_amd            32768  0
mac_hid                16384  0
gpio_amdpt             20480  0
wmi                    36864  3 wmi_bmof,mxm_wmi,nouveau
acpi_cpufreq           28672  0
ext4                  815104  1
crc32c_generic         16384  0
crc16                  16384  1 ext4
mbcache                16384  1 ext4
jbd2                  139264  1 ext4
xhci_pci               20480  0
crc32c_intel           24576  2
xhci_pci_renesas       20480  1 xhci_pci
xhci_hcd              286720  1 xhci_pci

EDIT: Followed these instructions and added cpufreq.default_governor=performance to /boot/grub/grub.cfg but that didn't work either. Not sure what Im doing wrong.

Re: How to Permanently Set Cpu to Performance?

Reply #8
Code: [Select]
I added cpufreq.default_governor= performance in /etc/modprobe.d/myconfig.conf but that didn't work either.

Yes, that was wrong idea, when I wrote about boot manager 😂😂

I will try if it works for me.
Do you not use kernel-lts,or?


Re: How to Permanently Set Cpu to Performance?

Reply #10
adding "cpufreq.default_governor=performance" (space was a typo!) in to boot manager as kernel parameter works  absolutely perfectly!


Code: [Select]
[alium @ picasso ~] $ 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: Cannot determine or is not supported.
   hardware limits: 1.40 GHz - 3.70 GHz
   available frequency steps: 3.70 GHz, 2.30 GHz, 1.40 GHz
   available controllers: performance schedutil
   current tactics: the frequency should be between 1.40 GHz and 3.70 GHz.
                     The "performance" controller can decide which frequency to use
                     within these limits.
   current CPU frequency: 3.70 GHz (asserted by call to hardware)
   boost state support:
     Supported: no
     Active: no
     Boost States: 0
     Total States: 3
     Pstate-P0: 3700MHz
     Pstate-P1: 2300MHz
     Pstate-P2: 1400MHz
Code: [Select]
[picasso alois]# dmesg | grep governor
[    0.000000] Command line: BOOT_IMAGE=../vmlinuz-linux-zen root=/dev/nvme0n1p2 rw net.ifnames=0 sysrq_always_enabled=1 cpufreq.default_governor=performance initrd=../amd-ucode.img,../initramfs-linux-zen.img
[    0.038144] Kernel command line: BOOT_IMAGE=../vmlinuz-linux-zen root=/dev/nvme0n1p2 rw net.ifnames=0 sysrq_always_enabled=1 cpufreq.default_governor=performance initrd=../amd-ucode.img,../initramfs-linux-zen.img

Are you really re-generating the grub after editing?
Code: [Select]
 grub-mkconfig -o /boot/grub/grub.cfg
put here your /boot/grub/grub.cfg.  the mistake is somewhere on your side (you do things differently than the instructions)

Re: How to Permanently Set Cpu to Performance?

Reply #11
adding "cpufreq.default_governor=performance" (space was a typo!) in to boot manager as kernel parameter works  absolutely perfectly!

I edited the /boot/grub/grub.cfg directly (without the space, figured it was typo) so I didn't regenerate the grub cfg.

Are you really re-generating the grub after editing?

This time I  edited the /etc/default/grub instead and regenerated the cfg and my cpu is no longer at 2.2ghz after reboot, so it worked! Thanks for your time and help.

However Im a bit confused now, after regenarating and rebooting I looked at the /boot/grub/grub.cfg and it seems to be exactly how I manually edited it, how come manual edit didn't work?  ???

Ahh, theres Artix Linux, Advanced options for Artix Linux and Artix Linux, with Linux linux (fallback initramfs) . I must have edited the wrong line.