View previous topic :: View next topic |
Author |
Message |
jserink Veteran
Joined: 30 Jan 2004 Posts: 1013
|
Posted: Tue Feb 12, 2008 2:38 pm Post subject: Tweaking cpufreq_conservative.c |
|
|
Hi All:
On my ferarri 5000 AMD turion 64x2 laptop, the conservative frequency governor was working but not as fast as I would have liked.
To speed it up, I put this line in my /etc/conf.d/local.start:
cat /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate_min > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate
Problem is, my sampling_rate_min was 3200000 or 3.2 seconds which means my CPU would need to be more than 80% for over 3 seconds before anything would happen. AND, you just can't push say 1000000 into sampling_rate, it will reject it. Same if you tried that with sampling_rate_min.
Ok, this is Linux and I have the source, its hack time......
and our victim is, cpufreq_conservative.c.
In that file you will find this line:
#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)
I changed that value to 100 which basically means my min sampling rate should drop from 3.2 seconds to 0.32 seconds. The file is very well commented so you can have a read as to what does what.
Recompiled the modules, loaded them up and bang, worked like a charm. Now my laptop's frequency reacts nice an quick to any increased load.
Cheers,
John |
|
Back to top |
|
|
Jinidog Guru
Joined: 26 Nov 2003 Posts: 593 Location: Berlin
|
Posted: Tue Feb 12, 2008 9:06 pm Post subject: |
|
|
Why not simply use the "ondemand" governor? _________________ Just unused Microsoft-Software is good Microsoft-Software |
|
Back to top |
|
|
jserink Veteran
Joined: 30 Jan 2004 Posts: 1013
|
Posted: Wed Feb 13, 2008 1:58 am Post subject: on demand governor |
|
|
Because the ondemand governor takes my machine from 800MHz to 2000MHz in one go, nothing in between.
Also, the not sure what the min sampling rate is for th eon demand governor is, haven't checked. |
|
Back to top |
|
|
Neo2 Apprentice
Joined: 25 Sep 2006 Posts: 224 Location: Italy
|
Posted: Tue Feb 19, 2008 1:36 pm Post subject: |
|
|
Please read some docs at www.lesswatts.org, if you really want to save power (for longer battery life I guess). You should try to reduce the number of wakeups per second from idle states for your CPU and make sure that the CPU will stay in idle and deeper (C2, C3) states for longer time. What you're doing instead will make your CPUs wake up at least 3 times more in a second, not counting additional overhead for the execution of the sampling algorithm for the conservative governor. That hack will probably lead to shorter battery life than you currently have (not that much, but it's always less).
Emerge powertop and give it a try. I reduced my laptop wakeups from ~200ps to ~65ps. It's not optimal, but it's always better than nothing. Now my battery lasts 3.3 hours instead of 2.1.
If you want powertop to work at its best you should recompile your kernel with following options:
Code: | CONFIG_TIMER_STATS=y (will enable timer statistics, slight overhead)
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y (these two will enable you to see from powertop which kernel routines are waking up your CPU. slight overhead) |
Instead, for direct tweaking:
Code: |
CONFIG_NO_HZ=y (this will try to wakeup the CPU only when an interrupt makes a request)
CONFIG_HZ_100=y
CONFIG_HZ=100 (these two will make your kernel wake up lesser times per second, I've seen nice performance boost, though CONFIG_NO_HZ should make this useless) |
Once you're done with tweaking you may as well remove the first three options to remove the slight performance impact they have.
Ondemand governor is recommended because it will make your CPU react faster to events, so that you can get back to idle states in shorter time.
This is for powersaving/performance... but of course, if you just want your CPU react quickly and don't mind spending battery life that hack is okay _________________ Neo2
Unofficial minimal liveCD for x86/amd64 w/reiser4+truecrypt |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|