LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-28-2018, 01:42 PM   #1
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 999

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
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
 
Old 08-28-2018, 02:34 PM   #2
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
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.
 
2 members found this post helpful.
Old 08-28-2018, 03:03 PM   #3
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
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
 
3 members found this post helpful.
Old 08-28-2018, 03:33 PM   #4
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 999

Original Poster
Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
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
 
2 members found this post helpful.
Old 08-28-2018, 05:02 PM   #5
RadicalDreamer
Senior Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 1,816

Rep: Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982
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.
 
2 members found this post helpful.
Old 08-28-2018, 06:22 PM   #6
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
When governor is set "ondemand", is there a way to follow dynamically the status change ? Or is it just to look at cpu activities ?
 
Old 08-28-2018, 07:12 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,241

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
https://www.kernel.org/doc/Documenta...user-guide.txt

The current frequency of cpu 0 is at:

/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

You could, say, have Conky "cat" that every second.
 
1 members found this post helpful.
Old 08-28-2018, 07:53 PM   #8
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,692

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
with conky I use
Code:
awk '/cpu MHz/{i++}i==1{printf "%.f",$4; exit}' /proc/cpuinfo
to show the cpu freq changes in real time.

Last edited by Daedra; 08-28-2018 at 08:00 PM.
 
2 members found this post helpful.
Old 08-28-2018, 08:01 PM   #9
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 999

Original Poster
Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
Keep in mind the frequency adjustments are much more rapid than you can observe.

The way to measure the difference is to write a benchmark which goes from idle to full load and back to idle in less than one second.
Ed
 
2 members found this post helpful.
Old 08-28-2018, 08:16 PM   #10
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,692

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Quote:
Originally Posted by lougavulin View Post
When governor is set "ondemand", is there a way to follow dynamically the status change ? Or is it just to look at cpu activities ?
to see it in a terminal in realtime you can also use

Code:
watch grep \"cpu MHz\" /proc/cpuinfo
and EdGr, what you said is true but I think viewing the change every second or so give you the information you would need.
 
3 members found this post helpful.
Old 08-28-2018, 08:29 PM   #11
RadicalDreamer
Senior Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 1,816

Rep: Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982
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
Attached Thumbnails
Click image for larger version

Name:	performance.png
Views:	130
Size:	36.4 KB
ID:	28473   Click image for larger version

Name:	ondemand.png
Views:	98
Size:	36.2 KB
ID:	28474  
 
1 members found this post helpful.
Old 08-29-2018, 12:06 AM   #12
denydias
Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 297

Rep: Reputation: Disabled
I have this on my laptops:

Code:
$ 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

Last edited by denydias; 08-29-2018 at 12:14 AM.
 
4 members found this post helpful.
Old 08-29-2018, 03:31 AM   #13
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,063

Rep: Reputation: Disabled
This thread can be marked as solved:
Code:
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.
 
2 members found this post helpful.
Old 08-29-2018, 04:14 AM   #14
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
Thank you all for your answers and explanations !
 
Old 08-29-2018, 04:54 AM   #15
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 999

Original Poster
Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
Marking thread as solved. We just got faster computers.
Ed
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU frequency governor configuration yanf81 Linux - Software 12 11-15-2015 12:03 PM
LXer: Samsung Introduces "LAB" Linux Frequency Governor LXer Syndicated Linux News 0 04-10-2013 04:31 AM
[SOLVED] compiz fusion " cpu frequency scaling unsupported" mad11 Linux - Newbie 0 03-19-2010 07:10 AM
[SOLVED] Using the "powersave" governor on battery and "ondemand" governor on AC power piratesmack Slackware 5 01-21-2010 12:54 PM
"CPU frequency is not supported and system is very very slow" kandhakumar Linux - General 3 06-29-2008 06:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration