9

After playing with GRUB profiling and installing preload, default scaling governor suddenly becomes 'performance' not 'ondemand'. I tried to enable /etc/init.d/ondemand service, but nothing changes - after reboot or resume, governor is always 'performance'. Do anybody knows what happened and how to revert old behaviour.

I'm using HP 6710s laptop.

Jorge Castro
  • 71,754

3 Answers3

13

You can Manually set the governor by running the cpufreq-set command (as root).

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

sudo cpufreq-set -c 0 -g ondemand

To install cpufreq-set:

sudo aptitude install cpufrequtils

cpufrequtils includes a daemon which allows users to set the desired scaling, governor and min/max clock speeds for all processor cores at boot-time. Before starting the daemon, edit /etc/default/cpufrequtils as root, selecting the desired governor and setting the min/max speed for your CPU(s), for example:

/etc/conf.d/cpufreq
#configuration for cpufreq control
# valid governors:
#  ondemand, performance, powersave,
#  conservative, userspace
governor="ondemand"
# valid suffixes: Hz, kHz (default), MHz, GHz
min_freq="1GHz"
max_freq="2GHz"

Source: archlinux.org

Mitch
  • 107,631
  • Thanks, this works fine. Probably when I have some time, I will try to find why this happened at all. – user65404 Jun 11 '12 at 06:57
  • 7
    It's /etc/default/cpufrequtils on Ubuntu, not /etc/conf.d/cpufreq. And the variables (as seen in /etc/init.d/cpufrequtils) are MAX_SPEED, MIN_SPEED and GOVERNOR. – elmicha Jun 19 '12 at 06:08
  • @elmicha I'll verify, and edit as needed. Thanks :) – Mitch Jun 19 '12 at 06:26
  • 1
    sudo cpufreq-set -c 0 -g ondemand will just apply to the frequency of the first CPU or core. So, for example, on a dual core system, you have to run sudo cpufreq-set -c 1 -g ondemand next, so it takes effect for both cores. – Eliah Kagan Jul 09 '12 at 02:09
  • Do all your CPUs at once: for cpu in $(seq 0 $(($(nproc) -1))) ; do echo sudo cpufreq-set -c $cpu -g ondemand ; done – artfulrobot Dec 08 '14 at 10:50
  • on Intel(R) Xeon(R) CPU E3-1231 v3 I have Invalid argument for anything other than performance, e.g. ondemand or conservative. – Patryk Nov 24 '15 at 17:07
  • @Patryk Maybe those aren't supposed on your cpu, which makes some sense for a server/workstation cpu. I'm sure there is a command to get all the supported ones. – Nobody Jul 17 '16 at 18:27
  • Oh, my bad, the basic cpufreq-info already lists the supported ones. Check the line available cpufreq governors: performance, powersave (here also on a Xeon E3 cpu). Edit: And I wrote "supposed" instead of "supported" in my last comment... – Nobody Jul 17 '16 at 18:49
  • @Mitch So, did you verify ? – Johan Boulé Apr 20 '17 at 21:08
  • @JohanBoule To change governor per CPU go to /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor, and change it to the desired governer. Do that for all available CPU`s. – Mitch Apr 20 '17 at 21:42
1

You can use following command to change governor:

cpufreq-selector -g ondemand

With this command, you don't need root privileges to change governor. Just add this command to Startup Applications... to change governor on login.

jokerdino
  • 41,320
Leonid
  • 11
  • 1
    Problem was in Jupiter which changes governor at each restart/resume even if program isn't running. – user65404 Jul 10 '12 at 09:04
  • You saved my day, I edited that command and use it with Cuttlefish to dim light and switch the governor on change of power ;) Man youre great! – Zbunjeni Nov 26 '14 at 23:59
0

Under Xubuntu, you also need to disable ondemand task by command:

sudo update-rc.d ondemand disable

the system boot cpu as GOVERNOR="performance" mentioned above

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Bill Zhao
  • 121