[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.
With all the feedback about this change I started to get worried about the use of mobile computers while on batteries with the default CPU governor configured on ondemand or performance, due to the increased power consumption of the CPU.
FYI: After reading this thread, having similar worries, I tested my Celeron N3050 (Braswell) laptop in battery mode and compared powersave (which equals ondemand in this case) against performance, using powertop for measurements. There was no statistically significant difference. Thus I decided to set the default to performance.
FYI: After reading this thread, having similar worries, I tested my Celeron N3050 (Braswell) laptop in battery mode and compared powersave (which equals ondemand in this case) against performance, using powertop for measurements. There was no statistically significant difference. Thus I decided to set the default to performance.
Thanks for your feedback on this. The CPU is the only component that uses a significant amount of power and by tuning it from OS level (PM driver & governor) it doesn't use its own autonomous PM (+BIOS) anymore.
The intel_pstate powersave governor shouldn't actually be considered the equivalent for the acpi-cpufreq ondemand, that's why this thread was started. It also depends on specific CPU implementation of the P-States and more importantly C-states, that intel_pstate->powersave makes use of to put the CPU in some deep sleep modes. Your CPU, which is not that "sophisticated" and more of an "entry level" type might not have many of these PM enhancements.
Also thanks for pointing to powertop, never used it actually and wondering how accurate it is in estimating the power consumption for a CPU like yours that has a TDP/SDP of 6W/4W: https://github.com/fenrus75/powertop
A question, while setting the intel_pstate on performance on your Celeron, have you noticed any dynamic change/scaling of the CPU frequency and what was the CPU fan doing, was it stopping during idle periods?
Last edited by abga; 09-10-2018 at 08:04 AM.
Reason: typo
Faulty or not, snail-ish or not, that "ondemand" governor brings up a functional system.
On Intel systems using the intel_pstate driver, ondemand is not a valid governor, so using it on an intel_pstate based system is not "functional". The changes that have been made keep ondemand as the default governor for all systemsunless they're using the intel_pstate driver.
A question, while setting the intel_pstate on performance on your Celeron, have you noticed any dynamic change/scaling of the CPU frequency and what was the CPU fan doing, was it stopping during idle periods?
I didn't check the frequencies, and this laptop has no fan. You are right about the remark on the accuracy of the measurement, given that the CPU power consumption is so low (almost always <4W, ~2.7W when idle). Indeed, in my case screen brightness matters almost as much as high CPU load. Still, I can say that I found powertop's estimates for remaining battery time to be fairly accurate, so it must be measuring the power consumption reasonably well (at least on my hardware).
On Intel systems using the intel_pstate driver, ondemand is not a valid governor, so using it on an intel_pstate based system is not "functional". The changes that have been made keep ondemand as the default governor for all systemsunless they're using the intel_pstate driver.
It is "functional" as the system does not crash by its fault and the box is up and running. That it is not also maybe "optimal", that's another story.
Anyway, even in the past was the ability to edit the wanted governor...
# ./.get-SB-readme TLP
##########################################################
# /home/dld/slackbuilds/14.2/system/TLP/README.Slackware #
##########################################################
Post installation steps:
# Give execute permission to rc.tlp
chmod +x /etc/rc.d/rc.tlp
# Start the tlp service
/etc/rc.d/rc.tlp start
# Restart acpid
/etc/rc.d/rc.acpid restart
# Configure tlp to be run at startup
add "/etc/rc.d/rc.tlp start" (without quotes) to /etc/rc.d/rc.local
After removal of this package you would need to revert the above
changes. Please make sure that you stopped the TLP service before
removing TLP.
If you have enabled any hooks in /usr/lib/pm-utils/power.d/ (they are
disabled by default), then the instructions given in the TLP developer
documentation can be followed.
http://linrunner.de/en/tlp/docs/tlp-developer-documentation.html#installscripts
################################################
# /home/dld/slackbuilds/14.2/system/TLP/README #
################################################
TLP implements advanced power management for Linux.
TLP is a pure command line tool with automated background tasks.
It does not contain a GUI.
Notes:
Remove any power saving settings/scripts (e.g.: in /etc/rc.local) or
laptop-mode-tools prior installing or TLP may not work properly
See README.SLACKWARE for more information about post-installation script
An additional configuration is available for Thinkpads.
See the website for more details.
http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html
I would be a little more careful when playing with the PM on the I/O subsystem and the connectivity interfaces, some of these don't like being "resurrected". On modern systems the majority of components have already their own autonomous PM (collaboration/orchestration(tuning) with/from the BIOS). The only one I'd focus on, mainly because its PM is left at the control of the OS/user (PM driver acpi-cpufreq & intel_pstate with their corresponding governors) would be the CPU. Taking care of it looks to be pretty simple with the help of acpid, as I myself learned and documented in post #71
It is "functional" as the system does not crash by its fault and the box is up and running. That it is not also maybe "optimal", that's another story.
I think Intel screwed up only providing two governors for their processors using intel_pstate, but that is my opinion and I'm sure hopeful they have good reasons for it.
Quote:
Originally Posted by Darth Vader
Anyway, even in the past was the ability to edit the wanted governor...
Did you read the file before you stated that you can't run your own governor? It certainly doesn't seem like it, because you can have your own governor set in a multitude of ways...
Code:
#!/bin/sh
#
# rc.cpufreq: Settings for CPU frequency and voltage scaling in the kernel.
# For more information, see the kernel documentation in
# /usr/src/linux/Documentation/cpu-freq/
# 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
# For CPUs using intel_pstate, always use the performance governor. This also
# provides power savings on Intel processors while avoiding the ramp-up lag
# present when using the powersave governor (which is the default if ondemand
# is requested on these machines):
if [ "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver 2> /dev/null)" = "intel_pstate" ]; then
SCALING_GOVERNOR="performance"
fi
# If rc.cpufreq is given an option, use it for the CPU scaling governor instead:
if [ ! -z "$1" -a "$1" != "start" ]; then
SCALING_GOVERNOR=$1
fi
# To force a particular option without having to edit this file, uncomment the
# line in /etc/default/cpufreq and edit it to select the desired option:
if [ -r /etc/default/cpufreq ]; then
. /etc/default/cpufreq
fi
# If you need to load a specific CPUFreq driver, load it here. Most likely you don't.
#/sbin/modprobe acpi-cpufreq
# Attempt to apply the CPU scaling governor setting. This may or may not
# actually override the default value depending on if the choice is supported
# by the architecture, processor, or underlying CPUFreq driver. For example,
# processors that use the Intel P-state driver will only be able to set
# performance or powersave here.
echo $SCALING_GOVERNOR | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 1> /dev/null 2> /dev/null
# Report what CPU scaling governor is in use after applying the setting:
if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
echo "Enabled CPU frequency scaling governor: $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
fi
unset SCALING_GOVERNOR
If you can make it through that file, you'll see several ways to set your own governor. Each item below is overridden by the next one if it is set, so keep that in mind.
Set SCALING_GOVERNOR to your desired governor in rc.cpufreq (processors using intel_pstate will have this option, and only this option, overridden)
Pass the specific governor to rc.cpufreq (either edit rc.M and replace "start" with the governor or call it again in rc.local)
Create/edit /etc/default/cpufreq and have SCALING_GOVERNOR set to whatever governor you want
By default, for ALL CPUs except for ones running intel_pstate, the default governor is ondemand.
Last edited by bassmadrigal; 09-10-2018 at 05:23 PM.
Did you read the file before you stated that you can't run your own governor? It certainly doesn't seem like it, because you can have your own governor set in a multitude of ways...
I know well the current script, AND I talked about the script from before all those changes.
AND, contrary what you say, I claim that was quite possible to chose the wanted governor and was very simple.
Was (from long time) as simple as changing into "/etc/rc.d/rc.cpufreq"
Code:
SCALING_GOVERNOR=performance
Complicated, huh?
AND, I for one I believe what is worth from those recent changes is just that default config, aka "/etc/default/cpufreq"
The rest is nitpicking and only goods known what. Probably some people has too much time on their hands, and love to invent work for our BDFL too.
Last edited by Darth Vader; 09-10-2018 at 06:33 PM.
I have been lurking on this thread but didn't have anything to say so I didn't
Thanks for the link !
Gotta try TLP on my work LapTop !
-- kjh
Thank you for your kind words, kjhambrick :-)
I have been lurking around too, this thread has been very informative.
Using TLP for more than 3 years now without noticing any adverse effects. Here are some defaults from its config file:
Code:
# Set CPU performance versus energy savings policy:
# performance, balance-performance, default, balance-power, power.
# Values are given in order of increasing power saving.
# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=power
# Disk devices; separate multiple devices with spaces (default: sda).
# Devices can be specified by disk ID also (lookup with: tlp diskid).
DISK_DEVICES="sda sdb"
# Disk advanced power management level: 1..254, 255 (max saving, min, off).
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
# Hard disk spin down timeout:
# 0: spin down disabled
# 1..240: timeouts from 5s to 20min (in units of 5s)
# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# See 'man hdparm' for details.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the kernel default scheduler for the particular disk.
#DISK_IOSCHED="cfq cfq"
# AHCI link power management (ALPM) for disk devices:
# min_power, med_power_with_dipm(*), medium_power, max_performance.
# (*) Kernel >= 4.15 required, then recommended.
# Multiple values separated with spaces are tried sequentially until success.
SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
With the default config laptop is responsive even on battery, with increase in battery life of around 1.5 hours.
YMMV.
P.S. powertop can be used to check power consumption and tunables.
So, you're complaining that Intel chips (which I don't even know if you own any... I think they're all AMD) have a different governor than others because the default, ondemand, isn't actually supported by the latest Intel chips?
Feedback:
My relative's computer with a 6700K processor is a bit unstable. Windows 7 crashes it and Windows 10 can't be installed because the computer blue screens halfway through the installation. It froze with the CPU governor set to "performance." It has never done this before. It has poor cooling. One core was running 66 C. When its set to "ondemand" the cores are below 40 C.
Feedback:
My relative's computer with a 6700K processor is a bit unstable. Windows 7 crashes it and Windows 10 can't be installed because the computer blue screens halfway through the installation. It froze with the CPU governor set to "performance." It has never done this before. It has poor cooling. One core was running 66 C. When its set to "ondemand" the cores are below 40 C.
As I understand it, your relative's CPU is "a bit unstable" and has "poor cooling". Setting the governor on performance should not be persistent after a reboot, I can't follow your situation there.
How did you set it ondemand? Have you blacklisted the intel_pstate driver providing the kernel boot parameter intel_pstate=disable ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.