You are here

Milestone overclocking - conservative governor

link: milestone-overclock

If you want to use the CPUfreq "conservative" governor as an alternative to the default "ondemand" governor, attached is the compiled kernel module (from Motorola sources).

From the kernel documentation:
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. This behaviour is more suitable in a battery powered environment.

After insmod, you can use:
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

If you want to change the sampling rate (to have a faster response to the load change), you can use:
echo 125000 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate
125000µs is the lowest possible value.
(For some reason, SetCPU won't set and keep any lower value than the default 250000µs for the conservative governor unless you use the echo command above.)

My settings in mot_boot_mode (for those interested):
insmod /system/lib/modules/overclock12.ko
echo 56 > /proc/overclock/max_vsel
echo 1000000 > /proc/overclock/max_rate
echo "1 750000" > /proc/overclock/freq_table
echo "4 750000000 42" > /proc/overclock/mpu_opps
echo "2 500000" > /proc/overclock/freq_table
echo "3 500000000 30" > /proc/overclock/mpu_opps
echo "3 250000" > /proc/overclock/freq_table
echo "2 250000000 22" > /proc/overclock/mpu_opps
insmod /system/lib/modules/cpufreq_conservative.ko
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 125000 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate

So my freq_table (cat /proc/overclock/freq_table) looks like this:
freq_table[0] index=0 frequency=1000000
freq_table[1] index=1 frequency=750000
freq_table[2] index=2 frequency=500000
freq_table[3] index=3 frequency=250000

And my mpu_ops table (cat /proc/overclock/mpu_opps):
mpu_opps[5] rate=1000000000 opp_id=5 vsel=56
mpu_opps[4] rate=750000000 opp_id=4 vsel=42
mpu_opps[3] rate=500000000 opp_id=3 vsel=30
mpu_opps[2] rate=250000000 opp_id=2 vsel=22
mpu_opps[1] rate=125000000 opp_id=1 vsel=32
/*unused*/

My CPU scales nicely between 250/500/750/1000 Mhz as can be seen from cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq and the CPU is undervolted on all but the highest frequency.

Beware that your CPU may not be stable at such low voltages as mine, you might need to set the vsel values higher in your case (e.g. echo 60 > /proc/overclock/max_vsel and echo "4 750000000 50" > /proc/overclock/mpu_opps etc.). Please, test your settings before you put them in your mot_boot_mode script permanently.

Comments

hi,
please, publish the sources of this module.
thx

CPUfreq is part of the kernel source (/drivers/cpufreq/cpufreq_conservative.c). To compile the module, I've used the Motorola kernel sources published here (specifically archive_0115-kernel.tgz).

Hi, I think I need to re-install Android thanks to your configuration in mot_boot_mode !

I even ran a stress test to make sure my phone wouldn't be unstable after reboot and it completed successfully!

I'm not sure what happened.

Does a minimum speed of 125 MHz result in instability? I think that was my only difference in configuration.

Also, how do you load the new frequencies to test them?

hi,
first: thank's for this module.
second: is this module useable only in conjunction with SetCPU, or is
possible to use without SetCPU ?
agree

It can be used without SetCPU. Actually, that's the way I'm using both the overclock.ko and cpufreq_conservative.ko modules. I set what I need in the mot_boot_mode script - the SetCPU would be redundant.

Hello, I'm using other method for OC, I set the parameters in autostart app, It works like a charm, I wanna keep installed SetCPU in order to see the Currently frequencies. How can I see them LIVE(real time) without using SetCPU. Thanks

Hi,

thanks for this module, only one question: as I can see from the information in the module's directory, it is governing down nicely, but only to 500MHz... I tried to set the down_treshold to 55 now, but still it keeps running 500, no 250 (top showing 75% idle). Is the parameter actually effective?

With my settings, I see 250000 most of the time (from cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq).
And I use the default down_threshold (20). So it works for me perfectly.

Hi there, and first of all, thanks for your terrific work!

In one of your replies you say that you set anything in mot_boot_mode... could you please post it? I don't know how to set the minimum frequency.

Thanks again!

you said :

"After insmod, you can use:
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

should we use insmod to call the cpufreq.ko first?

I'm new... can you please provide the script?

thx a lot.

Wow great, will try this.. see if battery life improved
Thanks nadlabak

I love this conservative governor so much!
It is what the battery saving strategy should be doing!

Nothize

I just tried this module and it works like a charm, way better scaling! in stead of jumping from lowest clock to the highest it wil increase more gently..

i did discover some issues with the setcpu profiles. because the scaling goes back to ondemand whenever a profile is changed.. so just disable the profiles and you can use the widget to check you cpu clock.

The profile issue was my bad, i forgot to adjust the profiles to use conservative in stead of ondemand.

I'm sorry if i missed it, but did you mention where to put that cpufreq_conservative.ko?

I put it to /system/lib/modules/ (where the stock modules reside).

Thanks for the reply, but when i do "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", it still says "ondemand".
Shouldn't that change to "conservative"?

Forgot to load it using insmod... ^^' nvm me~

Just a couple question to confirm what I think I already know

Since I don't want to over-clock and just get better battery life with conservative governer then I assume I only need the following 2 lines in my mot_boot_mode file

insmod /system/lib/modules/cpufreq_conservative.ko
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Also I don't know this but where is the mot_boot_mode file?

Yes, the two lines are enough for the activation of the cons. governor alone.
mot_boot_mode is originally a binary executable in /system/bin that is run only once, early during system start-up. If you have the original one still in place, you need to rename it to e.g. mot_boot_mode.bin and create your own script named mot_boot_mode that begins with:
#!/system/bin/sh
export PATH=/system/bin:$PATH
#run the original binary
mot_boot_mode.bin

And then continues with your custom commands.

Don't forget to set the executable permissions for the new script file: chmod 755 /system/bin/mot_*

hi nadlabak,
I put "cpufreq_conservative.ko" in /system/lib/modules/
and type in terminal:

insmod /system/lib/modules/cpufreq_conservative.ko
echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Is it wrong?

I thought that maybe last time I hadn't changed the permissions properly (it's annoying that tabbed autocomplete doesn't work in ADB) but I ran all the steps again (this time running a Nandroid backup before modifying the mot_boot file) and I got the same result. It's not a reboot loop, but every app just force closes as soon as I get the login screen.

Again, how can I test my settings? Loading them in by command line doesn't seem to have any effect even though overclock.ko and conservative.ko have both successfully been insmodded...isn't this weird?

Does SetCPU interfere? Would G.O.T.'s overclock script interfere? (I didn't use it the second time and still had the same problem)

Thanks,
NighTalon, NYC

I use it on my xt720

First, 10x for your great work:)

i have found this setting good for me (smooth performance, without the slight delay from sleep to top speed)

after loading, a setup the following in the freq table:
mpu_opps[5] rate=900000000 opp_id=5 vsel=56
mpu_opps[4] rate=600000000 opp_id=4 vsel=38
mpu_opps[3] rate=400000000 opp_id=3 vsel=26
mpu_opps[2] rate=250000000 opp_id=2 vsel=20
mpu_opps[1] rate=125000000 opp_id=1 vsel=20

after reading the docs regarding conservative i have used this "tweaks"

echo 40 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/down_threshold
e.g. step down if cpu usage is below 40%

echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/ignore_nice_load
e.g. ignore usage of not so important tasks (if any:)

echo 160000 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate
e.g. make change decision more frequent than default

echo 16 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/freq_step
hmm., this in my opinion is in tight connection with used freq table (that`s way i posted it too)
basically, this means that stepping will be in 16% of max freq (e.g. in my case 900*0.16 144 Mhz).
so with my frequencies it will take almost exact steps to match frequencies.

Actually i dont know how exactly the jumping between frequencies is made, but i suppose it is as follow

Let assume i am on 250 MHZ and cpu load is enough for step up..

first steping up
a. default 250+45 = 295 (so it will be 250 or 400)
b. my settings 250+144 = 394 (so it will be 250 or 400)

continuois stepping up:

a. default 295 +45 = 330 (so it will be 250 or 400)
b. my settings 394 + 144 = 538 ( so it will be 400 or 600)

continous stepping up:

a. default 330+45 = 375 (so it will be 250 or 400)
b. my settings 538 + 144 = 682 (so it will be 600 or 900)

so faster "top speed-ing" and faster "relax-ing"

of course i can have wrong assumption, but with this settings i feel better response:)

It appears that the ignore nice processes option and up/down percentages are not functional in latest froyo for milestone from Motorola. Can anybody confirm?

comment_body[und][0][value]

comment_body[und][0][value]

comment_body[und][0][value]

comment_body[und][0][value]

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.