CPU Frequency Scaling defaults to "Performance" instead of "OnDemand"

Bug #344252 reported by Neil Broadley
138
This bug affects 23 people
Affects Status Importance Assigned to Milestone
cpufreqd (Ubuntu)
Confirmed
Undecided
Unassigned
Nominated for Jaunty by Neil Broadley
linux (Ubuntu)
Incomplete
Undecided
Unassigned
Nominated for Jaunty by Neil Broadley

Bug Description

Binary package hint: cpufreqd

Ubuntuforums thread : http://ubuntuforums.org/showthread.php?t=1098459

In Jaunty 9.04, a few days ago, it was noticed that the default CPU frequency is now "Performance". Before, it was set to "OnDemand". This can be changed back again on a per-session basis by clicking on the CPUFreq applet (in gnome) and changing the setting to whatever is desired, or changed permanently either by updating "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" or using "cpufreq-selector -g ondemand"

However, when using a laptop, this is not desirable default behaviour as the effect on battery is obvious. This setting should be "OnDemand" by default.

Revision history for this message
Chak Man Yeung (dasunst3r) wrote :

Whenever I boot the system, the governor is set to Performance by default, and I would have to change it back to Ondemand every time. It gets very annoying, and I would really like a choice in choosing what speed governor I use when I'm on AC power and on battery power.

Revision history for this message
Neil Broadley (scaine) wrote :

Yep, confirmed here too. Even when updating /sys/devices/cpu0/cpufreq/scaling_governer (for both my CPUs), it still reverts back to Performance on next boot, so clearly there's a script over-writing this. I thought there might be something in /etc/default, but I can't see anything relevant at a glance (I'm no expert).

Revision history for this message
Andy Lawrence (amlawrence) wrote :

Also confirmed here. I defaults to performance on every boot.

Revision history for this message
jsolomon (josephwsolomon) wrote :

Confirmed.

Revision history for this message
xbmc50 (xbmc50) wrote :

Applies also to HP Pavilion DV7 1003oe series with 64bit Jaunty install
2.6.28-10-generic #33-Ubuntu SMP Mon Mar 16 23:49:27 UTC 2009 x86_64 GNU/Linux

Revision history for this message
Tuomas Aavikko (taavikko) wrote :

As multiple persons affected, changing status to confirmed.

Changed in cpufreqd:
status: New → Confirmed
Revision history for this message
Giovanni Condello (nanomad) wrote :

Just found this:

nanomad ~ $ grep -i default_gov /boot/config-2.6.28-10-generic
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

It seems like the kernel is compiled the wrong way. It should be CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

Revision history for this message
Dave (kvieto-googlemail) wrote :

Confirmed.

Revision history for this message
Andrea Chiavazza (andrea-c7a) wrote :

Even though the latest kernel is still compiled with performance as default governor it appears that once the desktop is loaded the governor is set as ondemand. My guess is that now the governor used is saved on shutdown and reloaded on startup.
I am not sure where this is saved and by what application but this bug should be considered closed nevertheless.
Can anybody confirm this ?

Revision history for this message
Sebastian Keller (skeller) wrote :

There is a script called "/etc/init.d/ondemand" which sets it to ondemand 60 seconds after boot. It is part of the "initscripts" package and I guess the purpose of this is to speed up booting by using the performance scheduler during boot.

Revision history for this message
Giovanni Condello (nanomad) wrote :

Seems fixed with the latest updates (ondemand governor is selected upon boot)

Revision history for this message
Jaroslav Šmíd (jardasmid-gmail) wrote :

Fixed for me too.

saads (shakhshir)
Changed in cpufreqd:
status: Confirmed → Fix Released
Revision history for this message
Cory Maccarrone (darkstar6262) wrote :

Can this be selectively disabled? When my laptop is on ondemand, it very aggressively scales the CPU down, making the system practically unusable. I would much rather the CPU go to ondemand when using battery and be on performance when on AC power.

Revision history for this message
Andreas Berger (andi-berger) wrote :

Not fixed. (for me?)

It takes half a minute after login to change from Performance to Ondemand. That's the time i have to wait now to switch it to whatever governor i prefer. Because if i set it to Powersave immediately after login it gets switched back to Ondemand after that half minute.

Revision history for this message
Andreas Berger (andi-berger) wrote :

Steps to reproduce a situation for which this bug is still problematic:

1. add "cpufreq-selector -g powersave" to /etc/rc.local (instead of powersave use your preferred governor)
2. reboot
3. watch governor be reset to ondemand about half a minute after login
4. change governor back to your preferred one again

the time it takes for the governor to automatically switch to ondemand after login seems arbitrary. is this intentional?

Revision history for this message
Andreas Berger (andi-berger) wrote :

since this bug in its original form is fixed, should i make a new bug report for the problem mentioned above?

Revision history for this message
Guglielmo Cola (guglielmocola) wrote :

Strange problem here.
Often (but not always) the governor is not set to Ondemand after 60 seconds, but remains set to Performance.

Using Jaunty with latest updates.

Revision history for this message
Lele83x (lele83x) wrote :

[quote] Strange problem here.
Often (but not always) the governor is not set to Ondemand after 60 seconds, but remains set to Performance.

Using Jaunty with latest updates.[/quote]

I have the same problem, sometimes the governor is NOT set to ondemand after 60 seconds.

Revision history for this message
Marcos Jr (junalmeida) wrote :

I can confirm. I have Jaunty 64 with latest updates running on hp tx2110us.

Revision history for this message
Marcos Jr (junalmeida) wrote :

 I can confirm it using Jaunty 32, evn with latest updates, cpu defaults to Performance.

Revision history for this message
eymey (eymert) wrote :

Same problem here!

In fact, the lack of useful powersave settings in Ubuntu (but Linux-based laptops/desktops in general) is annoying me even since I started to use Linux in non-server environments regularly.

When will there be a proper setting in ubuntu (or more generic in the designated config tools or a config file) where the user can just select a cpufreq governor him-/herself?

Also the ability to distinguish between "when on AC power" and " when on battery" could be a great one. Because I would like to have my laptop on "ondemand" during normal work (so the fan will keep itself quiet) and "conservative" on battery. Also when using a HTPC or other systems that are turned on the whole day, these settings could be useful.

But to confirm the problem: On my 2 Jaunty systems at home, the governor is also "performance" always.

Revision history for this message
ericc (eric-cheminot) wrote :

I have the same problem (Jaunty 32bit). Except that it is not always the case : sometimes it is set on 'ondemand' after login and sometimes 'performance'. I have not found the conditions yet...

Revision history for this message
8200 (8200) wrote :

I can confirm this bug too on my acer aspire 5610 laptop. After starting it is set to "performance".

Jaunty 32bit with all latest updates.

Revision history for this message
bford16 (bford16) wrote :

Confirmed as a problem here with kernel 2.6.28-13-generic with all updates. After starting set to 'performance.'

Matt Zimmerman (mdz)
Changed in cpufreqd (Ubuntu):
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Changed in cpufreqd (Ubuntu):
assignee: Canonical Foundations Team (canonical-foundations) → nobody
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Same problem with kernel 2.6.31-14-generic (Ubuntu 9.10). HP Pavillion dv5-1010eu laptop.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The kernel default is "performance" because it is the only sensible setting while booting; after the boot and desktop login have finished, it's somewhat hackily set back to "ondemand"

Revision history for this message
olivernz (olivernz) wrote :

Same problem here P4 1.7Ghz, DELL Optiplex GX270. Just stays in performance no matter what I do and I've done this on dozens of machines. Seems to be 9.10.

Revision history for this message
jap1968 (jap1968) wrote :

Same problem here: Asus EeePC with Celeron M at 900MHz. Eight levels available (from 112MHz to 900MHz). I can choose a fixed frequency level, but I am unable to change the policy. I am not able to choose ondemand (even after doing that, the system remains in performance mode)

Ubuntu 9.10, 32 bit, kernel 2.6.31-15

Revision history for this message
David Clayton (dcstar) wrote :

Is also a problem in 10.04 alpha as of this date. It can be set to something else with the CPU Frequency Scaling Monitor applet but it starts the Gnome session in "Performance" mode and any change does not seem to stick for a future session.

Revision history for this message
David Clayton (dcstar) wrote :

More info, in 9.04 the gnome-applets package could be set with root privileges so the CPU Frequency Scaling Monitor would be able to change things when it was loaded, in 10.04 this is no longer possible and the CPU Frequency Scaling Monitor requires a admin password to change the setting.

This security change seems to have broken any method of setting this automatically after a reboot.

Revision history for this message
W. Kyle White (kyle-white) wrote :

For comment #27, #28 - I have an Optiplex GX270 and a laptop which can't be set to ondemand or conservative. It seems to be a problem with any computers I have which use p4_clockmod - try:
$lsmod | grep p4_clockmod
The only workaround I've found is to install and start powernowd with the system, and set the governor to userspace. This is set in arch in the /etc/conf/cpufreq.conf file (sorry, don't have the details for Ubuntu). I think you could put "cpufreq-selector -g userspace" in /etc/rc.local or a runlevel script in ubuntu.

Revision history for this message
johnnynyquist (johnnynyquist) wrote :

Just a "me too." I would prefer that I be able to select the default CPU freq mode persistently. So there are two issues here: (1) the wrong default (should be ondemand), and (2) the mechanism for overriding the default, already an ugly hack, (/etc/init.d/ondemand) no longer works.

Why not just start in 'ondemand'? If the frequency scaler really does respond to CPU demand, then it should work the same as 'performance' on boot-up anyway.

Changed in cpufreqd (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Marcos Negrete Cedeño (marcos-negrete) wrote :

Confirmed. Acer 5536 laptop (AMD64) running Ubuntu 10.04 beta 1 I found the same init.d script that modifies the frequency to "ondemand" after 60 seconds, but apparently this does not run correctly, so it is with apache and postgres, several times I had to start them manually. Maybe the problem is in the boot sequence.

I agree with johnnynyquist: the default should be ondemand.

Revision history for this message
gmcd (gmcd) wrote :

Same problem here. Ludic Beta 2, latest updates and kernel

Revision history for this message
Patrick Lindsey (patrick.lindsey) wrote :

Same here Lucid Final latest updates. A year old bug for this??!!

Revision history for this message
Mehul J. Rajput (mehulrajput) wrote :

Yes confirm this in lucid too... every time I login I have to change the cpu frequency from the applet... little annoying not sure how it didn't make it to the paper cuts list of issues which were fixed....

Revision history for this message
Jiri Trnka (jiri-trnka-79) wrote :

I also confirm this bug in Lucid with all updates. The problem is inside /etc/init.d/ondemand script. (Bug #576022)

At line 19:

... /etc/init.d/ondemand -- background

should be changed to

... /etc/init.d/ondemand background.

Ondemand script waits for 60s after startup and then swithes CPU scaling to ondemand mode. It considers only [start|background|stop] as the first parameters when being run, so "--" is something which causes the script to do nothing.
This solves the problem (at least for my laptop with Pentium Dual Core, fresh installation of Ubuntu 10.04). However this problem does not occur on my desktop (Core2Duo, recent upgrade from Interpid to Lucid) although I have not removed the mistake from ondemand script... strange

Revision history for this message
rene gommes (rene-gommes) wrote :

On my Dell D830 with core duo and Lucid, the trick above (changing "-- background" to "background") does not work

Revision history for this message
FactTech (launchpad-facttechnologies) wrote :

I'm not 100% positive this is the right bug to be reporting on, but I have a situation similar to W. Kyle White (comment #31). A laptop I'm using with a fresh install of Lucid will not allow me to select anything other than "Performance" as the governor in the GNOME CPU frequency scaling applet. Other options are not greyed out, but selecting them results in no change. As with W. Kyle White, I'm using the p4_clockmod module.

I also made the changes to /etc/init.d/ondemand recommended by Jiri Trnka (commment #37), but there is no change in behavior after a reboot.

Revision history for this message
FactTech (launchpad-facttechnologies) wrote :

Regarding Jiri Trnka's comment #37, a closer look at the man page for start-stop-daemon at

http://manpages.ubuntu.com/manpages/lucid/man8/start-stop-daemon.8.html

seems to show that there should be no difference in behavior whether or not the "--" portion of the command is present. It's a legal (and, apparently, optional) parameter indicating that following parameters should be passed along.

Revision history for this message
jabberwok (neillhanna) wrote :

my athlon64 laptop stays at performance until I change it with the applet after boot
but on my core2 duo laptop it switches to ondemand a little while after login.

Both machines run lucid with the latest updates.

Revision history for this message
Ivan Kharlamov (the-paper-men) wrote :

I fixed this issue on my Lucid desktop by running

$sudo nano /etc/rc.local

and adding

cpufreq-selector -g ondemand

before "exit 0" line.

Revision history for this message
Daniel Lee (longinus00) wrote :

My laptop sometimes does not switch to ondemand as it should be. Calling /etc/init.d/ondemand manually after logging in seems to work.

Revision history for this message
guisardo (ubuntu-lucasmrancez) wrote :

I was having the same issue so I try this:

$ sudo start-stop-daemon --stop --name cpufreqd

$ sudo cpufreqd -D -V 7

That started the cpufreq daemon and print how the rules were evaluated.
So I find out than the problem is in the temp sensors. The sensors always shows 50ºC (122ºF) which is wrong so the rule selected by cpufreq is not the expected one.

Revision history for this message
johanhelgesson (johanhelgesson) wrote :

I also have this bug. The cpufreq govenor is always set to performance selecting the maximum freq (1.83GHz) for my 2 cores. I have to execute

sudo cpufreq-set -g ondemand -d 1000000 -u 1833000 -c 0
sudo cpufreq-set -g ondemand -d 1000000 -u 1833000 -c 1

to get to ondemand.

Annoyingly it does not help to add the commands to /etc/rc.local as they are reset after a while.

Revision history for this message
johanhelgesson (johanhelgesson) wrote :

The only way around it is to create a cronjob as root and reset to ondemand every once and awhile:

cronjob -e

add a job (every minute)

*/1 * * * * /usr/bin/cpufreq-set -g ondemand -d 1000000 -u 1833000 -c 0
*/1 * * * * /usr/bin/cpufreq-set -g ondemand -d 1000000 -u 1833000 -c 1

Ugly as hell but at least it keeps the heat and battery drain out of my system. Ubuntu really needs to get a grip on power saving =(

Btw. this is Ubuntu 10.10 - the Maverick Meerkat on an IBM X60

Revision history for this message
johanhelgesson (johanhelgesson) wrote :

OK, I think I got it...well at least for you guys having speed stepped Intel CPUs:

just edit '/etc/cpufreqd.conf' and make sure that the settings are correct. For me the default settings were

##
# Basic states
##
# when AC use performance mode
[Rule]
name=AC Rule
ac=on # (on/off)
profile=Performance High
[/Rule]

[Rule]
name=Movie Watcher
programs=xine,mplayer,gmplayer
battery_interval=0-100
acpi_temperature=0-60
cpu_interval=0-100
profile=Performance High
[/Rule]

This sucks. So I decommented the ondemand options and choose them instead:[Profile]
name=On Demand High
minfreq=40%
maxfreq=100%
policy=ondemand
[/Profile]

[Profile]
name=On Demand Low
minfreq=20%
maxfreq=80%
policy=ondemand
[/Profile]

[Profile]
name=Performance High
minfreq=100%
maxfreq=100%
policy=performance
#exec_post=echo 8 > /proc/acpi/sony/brightness
[/Profile]

##
# Basic states
##
# when AC use performance mode
[Rule]
name=AC Rule
ac=on # (on/off)
profile=On Demand High
[/Rule]

# stay in performance mode for the first minutes
[Rule]
name=AC Off - High Power
ac=off # (on/off)
battery_interval=70-100
#exec_post=echo 5 > /proc/acpi/sony/brightness
profile=On Demand High
[/Rule]

# conservative mode when not AC
[Rule]
name=AC Off - Medium Battery
ac=off # (on/off)
battery_interval=30-70
#exec_post=echo 3 > /proc/acpi/sony/brightness
profile=On Demand High
[/Rule]

# conservative mode when not AC
[Rule]
name=AC Off - Low Battery
ac=off # (on/off)
battery_interval=0-30
#exec_post=echo 3 > /proc/acpi/sony/brightness
profile=On Demand Low
[/Rule]

##
# Special Rules
##
# CPU Too hot!
[Rule]
name=CPU Too Hot
acpi_temperature=55-100
cpu_interval=50-100
profile=On Demand Low
[/Rule]

[Rule]
name=Movie Watcher
programs=xine,mplayer,gmplayer
battery_interval=0-100
acpi_temperature=0-60
cpu_interval=0-100
profile=On Demand High
[/Rule]

Revision history for this message
Davide P. (scaltro) wrote :

I can confirm the performance default governor is setted also in the last Ubuntu 10.10 Maverick Kernel 2.6.35-23.

Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

Hi Scaine,

Please be sure to confirm this issue exists with the latest development release of Ubuntu. ISO CD images are available from http://cdimage.ubuntu.com/daily/current/ . If the issue remains, please run the following command from a Terminal (Applications->Accessories->Terminal). It will automatically gather and attach updated debug information to this report.

apport-collect -p linux 344252

Also, if you could test the latest upstream kernel available that would be great. It will allow additional upstream developers to examine the issue. Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Once you've tested the upstream kernel, please remove the 'needs-upstream-testing' tag. This can be done by clicking on the yellow pencil icon next to the tag located at the bottom of the bug description and deleting the 'needs-upstream-testing' text. Please let us know your results.

Thanks in advance.

    [This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-kernel-logs
tags: added: needs-upstream-testing
tags: added: kj-triage
Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Neil Broadley (scaine) wrote :

I've changed laptops since reporting this bug 18 months ago. This is no longer the case on my Toshiba Satellite U405. I can no longer contribute to this bug except to suggest that this bug would go away if the app remembered what the user chose and stick to it. A common trait on the Gnome desktop - try turning off WIFI or Bluetooth, then reboot. Bam! Back on again. Pretty frustrating.

Someone else will have to confirm this bug, assuming it's still an issue in Maverick or Lucid.

Revision history for this message
Rik Shaw (rik-shaw) wrote :

Solution from comment #42 works for me, even after resuming from sleep it is "respecting" the "ondemand" setting. In summary:

edit:

/etc/rc.local

add:

cpufreq-selector -g ondemand

I have a Toshiba Tecra M10 Core2Duo 2.4GHz processor. Thanks for the help!

Revision history for this message
Ivan Kharlamov (the-paper-men) wrote :

Andy, thanks!
I'm glad to be helpful. :)

Revision history for this message
Giuseppe Santillo (santillogiuseppe) wrote :

This bug shows up in Ubuntu 10.10 64bit too. My CPU: AMD Athlon II X2 250.

Revision history for this message
Daniel Hollocher (chogydan) wrote :

I think this is still present in 14.04/14.10. I'm talking about the issue with cpufreqd

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

We are finally fixing this.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.