View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next

Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Mar 31, 2009 5:53 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Many thanks to graysky for pointing me in the right direction on how to do this.

By default R6 is configured for maximum performance at all times. If you're like me and know your box is idle a lot, but for one reason or another you need/want to keep it on 24/7 you can reduce it's power consumption with cpu frequency scaling. It's pretty simple:

(Note: This is for Intel based systems. See links below for info on AMD based systems.)

Code:
# modprobe acpi_cpufreq
# modprobe cpufreq_powersave


Then check your available governors:
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
powersave performance

and available frequencies:
Code:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2133000 1600000

To change to powersave:
Code:
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

And check the results:
Code:
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1600000
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave


Add a couple modules to /etc/rc.conf
Code:
MODULES=(acpi_cpufreq cpufreq_powersave)


And last but not least, create a couple bash scripts to enable/disable powersaving and place them in root's crontab (Don't forget to chmod them 744 first). Note that on multi-core systems, you'll need to do this for each core. I have a quad-core box, so the commands have to be repeated 4 times:

Code:
#!/bin/sh
#
# Enter powersaving mode
/bin/echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
/bin/echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
/bin/echo powersave > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
/bin/echo powersave > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

Code:
#!/bin/sh
#
# Enter performance mode
/bin/echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
/bin/echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
/bin/echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
/bin/echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor


Reference/Inspiration:
LessWatts
Arch Wiki: CPU Frequency Scaling (AMD users look here)

_________________
Mike
My Hardware Profile


Last edited by mihanson on Wed Apr 01, 2009 7:58 pm, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 31, 2009 6:50 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
:)

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 2:08 am 
Offline
Joined: Tue Feb 03, 2004 3:23 am
Posts: 159
Location: Friesland, The Netherlands
For K8 based CPUs even more power can be saved using cpupowerd as it allows undervolting as well:

http://cpupowerd.sourceforge.net


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 12:28 pm 
Offline
Joined: Thu Sep 27, 2007 5:44 pm
Posts: 580
I just set that up on my desktop and R5.5 KM box just last week mihanson :P

It just makes sense to me to use the ondemand module instead of performance or powersave. That way it will increase the clock speed if necessary and avoid stuttering, etc.

I was not able to get cpupowered that willem mentioned installed on my desktop, so I did not attempt it on my KM box. Actually, I believe it installs fine, but gives me errors whenever I try to run it, I got errors. Undervolting could be huge in keeping the processor cool.

I have particular interest in cooling the processor because my KM box is now in a totally enclosed tv stand. After seeing the temps climb way too high on the first day I decided to cut 2 holes for 120 mm fans that I have wired to a cheap thermostat to vent the air whenever the temperature in the TV stand raises to a certain point. It works pretty well, but if I could keep the heat from being generated at all, that would be even better.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 2:03 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Glad you wrote this up and hoping the devs will get it into the R6 proper.

Two things:
1) If you use an older nForce/Athlon XP based system as I do for LH, you definitely wanna use athcool (pacman -S athcool) which saves plenty of idle watts.

Here is my MBE's power consumption with athcool and without it:
Image

That's a 36 % reduction in power consumption!

2) You can also use powernowd which is better than the pre-set governors because it allows **you** to select the low/high CPU load when the multiplier kicks up/down. On my Ubuntu box, the settings file is /etc/defaults/powernowd which is oneliner.
Code:
OPTIONS="-q -u 15 -l 10"


-u defines the min amount of load needed to go to full power and -l defines the level when it will step down. In my case, <= 10 % stays at the lower multiplier and >=15 % triggers the jump to the high multiplier. This makes my system more responsive than any of the governors; there have been times when I'm using ondemand and tarring up a bunch of stuff and the multiplier was low.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 10, 2009 2:43 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Three things:

1) Can we move this HOWTO to the LinHES>Howto section?
2) You might wanna edit the first post of the thread to use the "ondemand" governor rather than the "powersave" one to allow the CPU to throttle up on tasks.

From the cpufrequtils article on the Arch wiki:
Code:
    * performance (default) -- The performance governor is built into the kernel and runs the CPU(s) at maximum clock speed
    * cpufreq_ondemand (recommended) -- Dynamically increases/decreases the CPU(s) clock speed based on system load
    * cpufreq_conservative -- Similar to ondemand, but more conservative (clock speed changes are more graceful)
    * cpufreq_powersave -- Runs the CPU at minimum speed
    * cpufreq_userspace -- Manually configured clock speeds by user


3) You can put it in crontab for root as you suggested or you can call it from /etc/runit/1.local which will run at startup. This is a fire-and-forget command only needing to be set once I believe.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 11, 2009 3:29 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Just opened a flyspray feature request for this:

http://linhes.org/flyspray/index.php?do ... ask_id=595

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 9:55 am 
Offline
Joined: Thu Sep 27, 2007 5:44 pm
Posts: 580
I just did a fresh install of R6 and:
1) cpufrequtils was not installed by default
2) cpufrequtils is not in the LinHES pacman repository
3) acpi_cpufreq module does not exist (probably because of 1 & 2)

Did you guys install it from source or was it available at one time?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 10:36 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
It's in there... I think it may have a hyphen in the name. Search w/ pacman:
Code:
$ pacman -Ss cpu


Also, the kernel module is included, and it does have a hyphen in the name:

Code:
# modprobe acpi-cpufreq

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 11:07 am 
Offline
Joined: Thu Sep 27, 2007 5:44 pm
Posts: 580
Code:
pacman -Ss cpu
extra/cpulimit 1.1-1
    Limit cpu usage in %. Actualy sends SIGSTOP/SIGCONT
extra/graphload 1-1
    command to graph the total CPU utilization for N-core systems for a given
    interval
extra/liboil 0.3.15-1
    Library of simple functions that are optimized for various CPUs.


Code:
modprobe acpi_cpufreq
FATAL: Error inserting acpi_cpufreq (/lib/modules/2.6.28-LinHES/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko): No such device


:(


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 11:18 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
What kind of system do you have (motherboard and processor)? Your error message on the modprobe suggests that that isn't the right kernel module for your hardware. If you ls -l that dir, I'm sure you'll see the physical file.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 11:37 am 
Offline
Joined: Thu Sep 27, 2007 5:44 pm
Posts: 580
You're right. Silly me, I have an AMD processor and that module is for Intel.
Code:
modprobe powernow-k8
doesn't report any errors.

I downloaded sysfsutils on pacman and I seem to be able to set up the ondemand governor now. I still do not have cpufrequtils installed, but I guess it is not necessary.

Thanks for the help.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 12, 2009 11:42 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Glad you got it working.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 15, 2010 7:28 pm 
Offline
Joined: Wed Jun 06, 2007 3:29 am
Posts: 38
Location: Australia
Thanks for the Howto info everyone.

My M3N78-EM/(65w)5000+ AM2 system drops from around 72w to 50w at idle and is nice and responsive with:
Code:
#modprobe powernow-k8
#echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#echo 20 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold


But I have a couple of problems: Without cpufrequtils or powernowd available, what would be a sensible way to organise these settings from boot?

The second problem I have with this is vdpau related (...and probably makes the first one redundant?!) - Playing a Blu-Ray (off the HDD) with mplayer using the onboard (8300)GPU, the CPU runs at something like 2% load and therefore doesn't scale up, this I believe leaves the HT scaled down too and kills the GPU performance, so stuttering/frame dropping abound.

Any pearls of wisdom would be most appreciated :)

HTD.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 15, 2010 7:44 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Harveythedog wrote:
Code:
#modprobe powernow-k8
#echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#echo 20 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

what would be a sensible way to organise these settings from boot?

You can place your above commands in /etc/runit/1.local (without the hashes (#)).

Harveythedog wrote:
Playing a Blu-Ray (off the HDD) with mplayer using the onboard (8300)GPU, the CPU runs at something like 2% load and therefore doesn't scale up, this I believe leaves the HT scaled down too and kills the GPU performance, so stuttering/frame dropping abound.


Try adding a cache to your mplayer config or on the command line:
Code:
mplayer -cache 8192 -cache-min 25 <blah blah>
This sets up a 8MB cache and tells mplayer not to start playing until it's at least 25% full. Seeking may be a bit spotty but it solved a similar problem I had.

_________________
Mike
My Hardware Profile


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 22 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu