Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to set both cores in my cpu to userspace governor by editing the contents of

/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

and

/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

to be userspace.

But after half of a minute, automatically, the content of the "cpu0" file changes back to "performance" and often jumps between "performance" and "powersave", while the content of the "cpu1" file remains "userspace".

$ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
userspace
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance

I was wondering

  1. why the "cpu0" file is edited automatically back,
  2. if it means that manually modifying its content is bad for some reason?
  3. Anyway to manually change its content to be "userspace"?

Thanks and regards!

share|improve this question
add comment

2 Answers

You don't normally set it to userspace manually; you run a user space governor and it takes over. What userspace governor are you wanting to run and why?

As for why it keeps changing back, you must be running another program that is changing it.

share|improve this answer
    
Thanks! (1) I want to change my cpu frequency to be fixed at 800MHz, by selecting it on CPU Frequency Scaling Monitor 2.30.0 shown in the panel. But for cpu0, after half a minute, it changes back to performance or powersave and therefore cpu frequency can be dynamically changed. So will setting the governor of cpu0 to userspace solve my problem? (2) How shall I "run a user space governor and it takes over"? What program I must be running to change the governer for cpu0? (3) For cpu1, why does editing /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor is enough unlike cpu0? Thanks! –  Tim Apr 8 '11 at 16:31
    
Changing the frequency with the frequency scaling monitor sets the governor to userspace. If it is changing back, then you have something else running on your system that is changing it. Also most systems can not change each cpu independent of the others; changing one changes them all. –  psusi Apr 8 '11 at 18:24
    
Thanks! (1) How can I know what is the something that changes it? (2) In my case, cpu1 can be changed, while cpu0 cannot. –  Tim Apr 8 '11 at 18:29
add comment

So is your question how can you manually change your all of your cpu's to run at a certain scaling frequency? If so I have 2 options you can choose from.

1 -- Change the "/etc/init.d/ondemand" file that sets the initial cpu frequency to "your_choice" after the system boots up. By default Ubuntu chooses to set your cpu's at the frequency ondemand using this file. To change this, open the file and look for the code (without quotes):

"echo -n ondemand > $CPUFREQ"

All you have to change is the word "ondemand" to your choice, for example I use "conservative" to cut down on some heat from my CPU. My code looks like this (without quotes):

"echo -n conservative > $CPUFREQ"

Also if you notice 3 lines above our selected code, it says "sleep 60". This just means that 60 seconds after your computer boots up it will execute this file and change the CPU frequency.

2 -- Taking a reference from the "/etc/init.d/ondemand" file you can manually change the CPU frequency through a terminal command. If you don't want to restart the computer this a great command. Create an empty file somewhere on your desktop and fill it with this:

! /bin/sh

for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor do [ -f $CPUFREQ ] || continue echo -n conservative > $CPUFREQ done

Make sure and change the frequency to what you want and all you have to do is open a terminal and type (without quotes) "sudo sh name_of_file". Type your password in and your done!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.