Arch Linux set cpu governor to performance

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Arch Linux set cpu governor to performance

Post by AnthonyCFox »

I've installed linux-rt (3.10.18-rt14-1-rt) and my cpu is Intel(R) Core(TM)2 Quad CPU Q9300

Now, I'm trying to set the cpu frequency to performance on start up, but it fails.

I installed cpupower and edited /etc/default/cpupower:

Code: Select all

# Define CPUs governor
# valid governors: ondemand, performance, powersave, conservative, userspace.
governor='performance'

# Limit frequency range
# Valid suffixes: Hz, kHz (default), MHz, GHz, THz
min_freq="2.00GHz"
max_freq="2.50Hz"
I ran systemctl enable cpupower.service

But after reboot I get:

Code: Select all

[tony@hydra ~]$ systemctl status cpupower.service
cpupower.service - Apply cpupower configuration
   Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled)
   Active: failed (Result: exit-code) since Tue 2013-11-12 07:13:15 PST; 42min ago
  Process: 218 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=1/FAILURE)
 Main PID: 218 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/cpupower.service
Here's the output from sudo journalctl | grep cpupower:

Code: Select all

Nov 11 19:03:45 hydra sudo[11586]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/pacman -S cpupower
Nov 11 19:32:46 hydra sudo[1444]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/cpupower info
Nov 11 19:43:06 hydra sudo[1469]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/cpupower frequency-set -g performance
Nov 12 05:48:25 hydra dbus-daemon[219]: dbus[219]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.13" (uid=1000 pid=4953 comm="systemctl enable cpupower.service ") interface="org.freedesktop.systemd1.Manager" member="EnableUnitFiles" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/sbin/init ")
Nov 12 05:48:25 hydra dbus[219]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.13" (uid=1000 pid=4953 comm="systemctl enable cpupower.service ") interface="org.freedesktop.systemd1.Manager" member="EnableUnitFiles" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/sbin/init ")
Nov 12 05:48:45 hydra sudo[4993]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/systemctl enable cpupower.service
Nov 12 05:50:44 hydra systemd[1]: Starting Apply cpupower configuration...
Nov 12 05:50:44 hydra systemd[1]: cpupower.service: main process exited, code=exited, status=1/FAILURE
Nov 12 05:50:44 hydra systemd[1]: Failed to start Apply cpupower configuration.
Nov 12 05:50:44 hydra systemd[1]: Unit cpupower.service entered failed state.
Nov 12 06:32:32 hydra sudo[8192]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/cpupower frequency-set -g
Nov 12 06:32:42 hydra sudo[8245]: tony : TTY=pts/0 ; PWD=/home/tony ; USER=root ; COMMAND=/usr/bin/cpupower frequency-set -g performance
Nov 12 06:56:14 hydra systemd[1]: Starting Apply cpupower configuration...
Nov 12 06:56:14 hydra systemd[1]: cpupower.service: main process exited, code=exited, status=1/FAILURE
Nov 12 06:56:14 hydra systemd[1]: Failed to start Apply cpupower configuration.
Nov 12 06:56:14 hydra systemd[1]: Unit cpupower.service entered failed state.
Nov 12 07:13:15 hydra systemd[1]: Starting Apply cpupower configuration...
Nov 12 07:13:15 hydra systemd[1]: cpupower.service: main process exited, code=exited, status=1/FAILURE
Nov 12 07:13:15 hydra systemd[1]: Failed to start Apply cpupower configuration.
Nov 12 07:13:15 hydra systemd[1]: Unit cpupower.service entered failed state.
Nov 12 08:16:51 hydra systemd[1]: Starting Apply cpupower configuration...
Nov 12 08:16:51 hydra systemd[1]: cpupower.service: main process exited, code=exited, status=1/FAILURE
Nov 12 08:16:51 hydra systemd[1]: Failed to start Apply cpupower configuration.
Nov 12 08:16:51 hydra systemd[1]: Unit cpupower.service entered failed state.
And it's still set to ondemand:

Code: Select all

[tony@hydra ~]$ sudo cpupower frequency-info -p
analyzing CPU 0:
1998000 2500000 ondemand
But, I can set it manually:

Code: Select all

[tony@hydra ~]$ sudo cpupower frequency-set -g performance
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
[tony@hydra ~]$ sudo cpupower frequency-info -p
analyzing CPU 0:
1998000 2500000 performance
Any ideas on where to go from here to get this working?
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
User avatar
funkmuscle
Established Member
Posts: 2801
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 129 times
Been thanked: 31 times

Re: Arch Linux set cpu governor to performance

Post by funkmuscle »

AnthonyCFox, check with the archlinux forum.. I've been meaning to do the same with that exact issue. Thanx for the reminder.
I haven't had the time to post that question yet.
looplog
Established Member
Posts: 34
Joined: Thu Aug 20, 2009 1:14 am

Re: Arch Linux set cpu governor to performance

Post by looplog »

I had the same issue a while back, and the only solution that worked for me was to compile the RT kernel with performance mode as the default. It basically involves changing a couple of lines in the kernel config file in the following section:

Code: Select all

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
I guess from above I disabled all other governors for good measure...
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: Arch Linux set cpu governor to performance

Post by AnthonyCFox »

I've been trying to avoid it but maybe it's time I built a kernel. I'll post this to the Arch forum first and see if anyone there has a different solution.
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
looplog
Established Member
Posts: 34
Joined: Thu Aug 20, 2009 1:14 am

Re: Arch Linux set cpu governor to performance

Post by looplog »

Where do you get your RT kernels from for Arch besides building them? I assumed you were using the AUR for that, in which case you can download the tarball at https://aur.archlinux.org/packages/li/l ... -rt.tar.gz instead of using yaourt or some other helper. From there you have to:

1. update the config file for your platform
2. run makepkg -g to get the new md5sum for that file
3. change the appropriate md5sum in the PKGBUILD file
4. run makepkg -s in the folder while you grab a coffee
Joermungand
Established Member
Posts: 276
Joined: Wed Oct 24, 2012 5:19 pm

Re: Arch Linux set cpu governor to performance

Post by Joermungand »

The RT kernel, wine-rt, and wineasio are available as binaries in the Archaudio Production repo:

Code: Select all

[archaudio-production]
SigLevel = Optional TrustAll
Server = http://repos.archaudio.org/$repo/$arch
looplog
Established Member
Posts: 34
Joined: Thu Aug 20, 2009 1:14 am

Re: Arch Linux set cpu governor to performance

Post by looplog »

Yet again a lesson in the pitfalls of assumption. Glad to see the repos are active again...
Joermungand
Established Member
Posts: 276
Joined: Wed Oct 24, 2012 5:19 pm

Re: Arch Linux set cpu governor to performance

Post by Joermungand »

:wink:
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: Arch Linux set cpu governor to performance

Post by AnthonyCFox »

This is as deep as I've ever been in tweaking for latency and the biggest thing I've learned is: Not all usb ports are the same.

This new (to me) computer has better specs than anything I've ever owned, yet even with the rt kernel and all the tweaks I've been able to do I was still getting more xruns than I was on my crappy old laptop. I thought my interface was dying. I thought my video card was too, because of the stuttering I was getting when I played lbreakout2, which is very (usb) mouse intensive.

I've since realized that two of my usb hubs are crap and one is good; so I moved the mouse and interface to the good one and the problems cleared up instantly.

I dropped my block latency down to 2.7 msec, gave it a good test and saw no xruns. I might be able to go lower, I haven't had a chance to test it yet. I could never get below 5.3 msec on my laptop with Ubuntu and the low latency kernel.
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: Arch Linux set cpu governor to performance

Post by AnthonyCFox »

I posted this to the Arch forum and boy the tone sure has changed in the three years since I was there last. Di-iiiiiiick-ish!!

I think it's a bug. Here's what one of them said:
I think the error may be in /usr/lib/systemd/scripts/cpupower. It doesn't work for me to append the values to the params array like that.
For example:
declare -a params=()
params+=(${governor:+-g $governor})
params+=(${min_freq:+-d $min_freq})
params+=(${max_freq:+-u $max_freq})
params+=(${freq:+-f $freq})
doesn't give me what I take it it should if I run it with test values. I set g to "34f" and h to "56g"
$ declare -a f=()
$ f+=(${g:+-g $g})
$ f+=(${h:+-h $h})
$ echo $f
-g
In contrast:
$ declare -a f=()
$ f+=${g:+-g $g}
$ echo $f
-g 34f
$ f+=${h:+-h $h}
$ echo $f
-g 34f-h 56g
So maybe it is just nor running the right command?
Between that, the Bash alias I set up for performance mode and a jerk coming out of the woodwork to criticize me because he didn't read everything I had posted in the thread, I'm done with the issue. :P
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
User avatar
funkmuscle
Established Member
Posts: 2801
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 129 times
Been thanked: 31 times

Re: Arch Linux set cpu governor to performance

Post by funkmuscle »

I think this wiki link may help.

Code: Select all

https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling#cpupower
Anthony, sometimes I'm afraid to post there at the Arch forum too. Very helpful when it's not audio related but otherwise, wow! :shock:
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: Arch Linux set cpu governor to performance

Post by AnthonyCFox »

funkmuscle wrote:I think this wiki link may help.

Code: Select all

https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling#cpupower
Yeah, I read that. I googled the hell out of this actually and that's how I realized the tone of the forums had changed. Nearly every forum post I looked at, someone was being a jerk.

It's too bad, stuff like this tends to build up quietly and then it publicly explodes. I expect that one of these days Archlinux is going to be known as the distro for arrogant pricks. Damn, I used to be proud to call myself an Archer - back when no one knew what that meant. :lol:
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
User avatar
wayneward
Established Member
Posts: 38
Joined: Wed Oct 29, 2014 8:47 pm
Contact:

Re: Arch Linux set cpu governor to performance

Post by wayneward »

i got the cpu power set with sudo cpupower frequency-set -g performance but think have to do this on every reboot .. ill check

also when run script on manjaro there is one problem with the realtime kernel i see

Try enabling tickless timer support (CONFIG_NO_HZ_IDLE, or CONFIG_NO_HZ in older kernels)
:oops:

[wayneward@manjaro ~]$ realTimeConfigQuickScan
== GUI-enabled checks ==
Checking if you are root... no - good
Checking filesystem 'noatime' parameter... 4.14.20 kernel - good
(relatime is default since 2.6.30)
Checking CPU Governors... CPU 0: 'performance' CPU 1: 'performance' CPU 2: 'performance' CPU 3: 'performance' - good
Checking swappiness... 10 - good
Checking for resource-intensive background processes... none found - good
Checking checking sysctl inotify max_user_watches... >= 524288 - good
Checking access to the high precision event timer... readable - good
Checking access to the real-time clock... readable - good
Checking whether you're in the 'audio' group... yes - good
Checking for multiple 'audio' groups... no - good
Checking the ability to prioritize processes with chrt... yes - good
Checking kernel support for high resolution timers... found - good
Kernel with Real-Time Preemption... found - good
Checking if kernel system timer is high-resolution... found - good
Checking kernel support for tickless timer... not found - not good
Try enabling tickless timer support (CONFIG_NO_HZ_IDLE, or CONFIG_NO_HZ in older kernels)

== Other checks ==
Checking filesystem types... ok.
ok.
** Set $SOUND_CARD_IRQ to the IRQ of your soundcard to enable more checks.
Find your sound card's IRQ by looking at '/proc/interrupts' and lspci.
Post Reply