[SOLVED] Suggestion: use "performance" CPU frequency governor
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Suggestion: use "performance" CPU frequency governor
The default "ondemand" governor maps to "powersave" on modern Intel CPUs. The powersave governor takes several hundred milliseconds to ramp to maximum frequency.
To work around this, I have in my /etc/rc.d/rc.local:
Code:
/etc/rc.d/rc.cpufreq performance
The difference is measurable on benchmarks. Interactive response is snappier. The computers still idle efficiently.
Disclaimer - all of my computers are AC powered.
Ed
Maybe that is useful for the Intel users, but for those having AMD processors your suggestion will make the CPU to stay at max frequency and the CPU fan to go nuts.
Also, for those with laptops, the "performance" governor will be a disaster no matter which company produced their CPUs.
So, how about yourself to tune your "/etc/rc.d/rc.cpufreq" and be happy with your micro-benchmarks? I talk about this well commented line:
Code:
# Default CPU scaling governor to try. Some possible choices are:
# performance: The CPUfreq governor "performance" sets the CPU statically
# to the highest frequency within the borders of scaling_min_freq
# and scaling_max_freq.
# powersave: The CPUfreq governor "powersave" sets the CPU statically to the
# lowest frequency within the borders of scaling_min_freq and
# scaling_max_freq.
# userspace: The CPUfreq governor "userspace" allows the user, or any
# userspace program running with UID "root", to set the CPU to a
# specific frequency by making a sysfs file "scaling_setspeed"
# available in the CPU-device directory.
# ondemand: The CPUfreq governor "ondemand" sets the CPU depending on the
# current usage.
# conservative: The CPUfreq governor "conservative", much like the "ondemand"
# governor, sets the CPU depending on the current usage. It
# differs in behaviour in that it gracefully increases and
# decreases the CPU speed rather than jumping to max speed the
# moment there is any load on the CPU.
# schedutil: The CPUfreq governor "schedutil" aims at better integration with
# the Linux kernel scheduler. Load estimation is achieved through
# the scheduler's Per-Entity Load Tracking (PELT) mechanism, which
# also provides information about the recent load.
SCALING_GOVERNOR=ondemand
Last edited by Darth Vader; 08-28-2018 at 02:40 PM.
Indeed, the intel_pstate driver only supports "powersave" (default) and "performance" and I can confirm what EdGr reported, the default "powersave" is just too lazy. This "powersave" should be the equivalent of the "ondemand" governor that works under the acpi-cpufreq driver for other non-Intel CPUs, but it's not. Like the OP suggested, I always set the governor on "performance" for Intel CPUs, even on laptops, without experiencing any thermal issues, the fan is indeed spinning a little and doesn't stop, but then I'm only using new (power efficient) CPUs, past Haswell.
Good lecture: https://www.kernel.org/doc/html/v4.1...el_pstate.html
+ https://www.kernel.org/doc/Documenta...user-guide.txt https://www.kernel.org/doc/Documenta.../governors.txt
I wrote some notes some time ago and considered disabling the intel_pstate driver and using the acpi-cpufreq instead, checking if its "ondemand" governor(algorithm) is better(faster) than the intel_pstate "powersave", but forgot about it. Thankful now about this thread, reminding me about it. Will need to go through these when I'll find some time available: https://unix.stackexchange.com/quest...r-conservative https://www.phoronix.com/scan.php?pa...linux315&num=1
Last edited by abga; 08-28-2018 at 03:54 PM.
Reason: CPUs
Darth Vader - the comments in rc.cpufreq are obsolete for modern Intel CPUs.
abga - thanks for the links!
On my Intel Nehalem, Sandy Bridge, and Haswell-E CPUs, there are only two governors, "performance" and "powersave". "Powersave" makes the Haswell-E desktop sluggish. "Performance" cuts its power consumption in half when idle. I have measured both.
My Sandy Bridge laptop does not mind being run in performance mode on AC power. Unfortunately, the laptop no longer has a working battery.
Ed
ondemand works fine for me. If I am using something demanding it takes a few seconds for it to ramp up. I tried performance recently for Rise of the Tomb Raider because that was their recommendation. After the game ended the CPU frequency was still at about max on a few cores. I like how ondemand is ondemand. Plasma 5 running Firefox only requires ~1.60 Ghz on all cores so I don't need it to run at about 4 Ghz all the time.
I did a before and after Slackware64 Current update. Here is ondemand and performance frequencies according to cpufreq-info. Plasma 5, one xterm open, and Firefox open with just this page with an i7 Ivy Bridge 3770. Performance has the CPU running ~2.20 GHz more.
One issue I came across with Rise of the Tomb Raider is that I couldn't set it back and forth from ondemand to performance on the command line. I tried /etc/rc.d/rc.cpufreq performance and it would change to performance but when I tried to set it back to ondemand the CPU still acted like it was on performance based on cpufreq-info and rc.cpufreq would report it as on performance. I was using these instructions under "More Performance Options": https://docs.slackware.com/studioware:tips_and_hints
$ ls -l /etc/pm/power.d/powermgmt
-rwxr-xr-x 1 root root 2197 jul 12 05:31 /etc/pm/power.d/powermgmt*
$ cat /etc/pm/power.d/powermgmt
#!/bin/sh
# File : powermgmt
# Author : Deny Dias <http://mexapi.macpress.com.br>
# Description : Manage various power related features according to the source.
# License : GPLv3
# Last Modified : 2015-07-12
# AC settings
if on_ac_power; then
# Set CPU Governor: Performance
/sbin/modprobe cpufreq_performance > /dev/null 2>&1
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
do echo performance > $cpu;
done
# Disable PCI autosuspend
for pci in /sys/bus/pci/devices/*/power/control;
do echo on > $pci;
done
# Disable Laptop-Mode disk writing
#echo 0 > /proc/sys/vm/laptop_mode
# Set VM writeback timeout: 500
#echo 500 > /proc/sys/vm/dirty_writeback_centisecs
# Set SATA channel: max performance
#for sata in /sys/class/scsi_host/host*/link_power_management_policy;
# do echo max_performance > $sata;
#done
# Disabile audio_card power saving
echo 0 > /sys/module/snd_hda_intel/parameters/power_save_controller
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
# Disable USB autosuspend
#for usb in /sys/bus/usb/devices/*/power/level;
# do echo on > $usb;
#done
# Battery settings
else
# Set CPU Governor: PowerSave
/sbin/modprobe cpufreq_powersave > /dev/null 2>&1
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
do echo powersave > $cpu;
done
# Enable PCI autosuspend
for pci in /sys/bus/pci/devices/*/power/control;
do echo auto > $pci;
done
# Enable Laptop-Mode disk writing
#echo 5 > /proc/sys/vm/laptop_mode
# Set SATA channel: power saving
#for sata in /sys/class/scsi_host/host*/link_power_management_policy;
# do echo min_power > $sata;
#done
# Set VM writeback timeout: 1500
#echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
# Enable audio_card power saving
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
echo 1 > /sys/module/snd_hda_intel/parameters/power_save_controller
# Enable USB autosuspend
#for usb in /sys/bus/usb/devices/*/power/level;
# do echo auto > $usb;
#done
fi
Edit: Oh! And also this in /etc/rc.d/rc.local:
Code:
# Disable Ethernet Wake-on LAN to save power
/usr/sbin/ethtool -s eth0 wol d
Tue Aug 28 22:05:19 UTC 2018
a/sysvinit-scripts-2.1-noarch-18.txz: Rebuilt.
rc.cpufreq: for CPUs that use intel_pstate, default to the performance
governor. The performance governor provides power savings while avoiding
the ramp-up lag caused by using "ondemand", which defaults to "powersave"
on these systems. Thanks to EdGr.
Thanks EdGr and Pat.
Last edited by Didier Spaier; 08-29-2018 at 03:32 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.