Jump to content

Speedfreq


ac_dispatcher
 Share

Recommended Posts

I recently started working on power management for my laptop. I decided that adjusting the cpu frequency was a good start.

 

Im running:

Gentoo

2.6.8 kernel

pure udev system

 

First I wanted to check if my compile kernel (and computer) supports it:

 

from the Gentoo docs:

Get current frequency

#cat /proc/cpuinfo | grep "cpu MHz"

 

List supported frequencies. This might fail.

#cd /sys/devices/system/cpu/cpu0/cpufreq/

#cat scaling_available_frequencies

 

Change frequency to 1 GHz (1000000 KHz)

Replace with a frequency your laptop supports.

#echo -n userspace > scaling_governor

#echo -n 1000000 > scaling_setspeed

 

Verify frequency was changed

#cat /proc/cpuinfo | grep "cpu MHz"

 

when I did cat scaling_available_frequencies I got:

300000 600000 900000 1200000 1500000 1800000 2100000 2400000

 

So I got a few settings to choose from. But I didn't want to do it manually. At first I wrote my own script so that when I was on battery it switched to a 1.2Ghz cpu (from 2.4Ghz). I want it to do it automatically using all available frequencies.

 

enter Speedfreq

 

Now I got it to work on my Gentoo Laptop but This threat is about speedfreq and basic cpu scaling in general.

 

speedfreq ReadMe:

This is a simple package for actively enforcing a CPU performance policy.

 

It supports 4 policies at present:

 

dynamic - the default policy, which monitors the amount of CPU idle

  time, and increases the CPU speed if it gets too low, or decreases

  it if it gets to high.  This is a good balance between battery life

  and performance, but some applications may experience erratic

  performance because of the latency in speeding up the CPU.

 

fixed - fixed CPU speed at a particular clock rate

 

powersave - kernel cpufreq driver's "powersave" policy

 

performance - kernel cpufreq driver's "performance" policy

 

Speedfreq is a client-server program.  At boot, the server,

speedfreqd, is started by init, with the initial policy.  The

speedfreq client command can be used to change the current policy or

other parameters, and query the current settings.  If the server is

started with "-u", non-root clients can change the current policy.

This is useful for single-user machines (ie, typical laptops).

 

When speedfreq is first run, it becomes a daemon.  It listens for

requests on a socket.  Subsequent instances of speedfreq talk to the

daemon to enact changes or query state.  Speedfreq doesn't do any

policy changes (for example, switching policies based on power source

or remaining battery life) - it assumes that an external entity will

know what to do and tell it to do it.

 

If the daemon is started with "-u", then it will allow non-root users

to set the current policy.

 

For developers, there are two client libraries.  C programmers can use

libspeedfreq, while Python programmers can use the speedfreq module.

 

I decided that dynamic was the way to go. Man has it worked great. My 2.4Ghz runs at around 300Mhz to 900Mhz most of the time. When I do some labor intensive stuff (like a compile)

WHAM up to 2.4Ghz it goes.

 

Now I haven't been able to test the extended life span of my battery yet. But I have already noticed that it runs a lot cooler. Usually it runs at 54*C and a normal load. Now its around 49-51*C with the same load.

 

Not sure if speedfreq is in urpmi repos. Can anyone using Mandy give some input on what they use to control cpu frequencies?

 

Also if you decide to try this you may need to compile a custom kernel.

 

[moved from Laptops by spinynorman]

Link to comment
Share on other sites

Moved to other Distros?

 

My thread was about cpu frequency in any Distro. I just have Gentoo installed. Does that automatically make it sent to other?

 

I wanted to know what other Laptop users use to control there cpu freq. Or does Mandy not have any cpu freq program.

 

 

Oh well "Other Distros" it is then.

Edited by ac_dispatcher
Link to comment
Share on other sites

Moved to other Distros?

 

My thread was about cpu frequency in any Distro. I just have Gentoo installed. Does that automatically make it sent to other?

 

I wanted to know what other Laptop users use to control there cpu freq. Or does Mandy not have any cpu freq program.

 

 

Oh well "Other Distros" it is then.

Moved on to Everything Linux. :)

Link to comment
Share on other sites

I use cpufreqd, it's automatic, throttling while on battery, and increasing power when on power, or if i need the CPU. I just installed it, put the default config in place and it runs sweet.

 

When on battery, my lappy runs at about 40C, power, 50C.

 

Very effective, and has increased battery life substantially.

 

iphitus

Link to comment
Share on other sites

  • 9 months later...

I tried your idea but it doesn't seem to work.

 

Mine is only scaling between 1800 and 1600 mhz but it ain't going down to 800Mhz like he's supposed to.

 

I checking the scaling frequencies and 800000 is in there.

 

 

 

[root@localhost cpufreq]# more cpuinfo_cur_freq

1600000

[root@localhost cpufreq]# more cpuinfo_m

cpuinfo_max_freq cpuinfo_min_freq

[root@localhost cpufreq]# more cpuinfo_max_freq

1800000

[root@localhost cpufreq]# more cpuinfo_min_freq

800000

 

 

[root@localhost cpufreq]# more scaling_available_frequencies

1800000 1600000 800000

Edited by Phantom
Link to comment
Share on other sites

hmmm, restarted the cpufreq service and all is ok now :wall:

 

 

[root@localhost cpufreq]# cat /proc/cpuinfo

processor : 0

vendor_id : AuthenticAMD

cpu family : 15

model : 12

model name : Mobile AMD Athlon 64 Processor 2800+

stepping : 0

cpu MHz : 802.008

cache size : 512 KB

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 1

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 pni syscall nx mmxext lm 3dnowext 3dnow

bogomips : 1587.42

Edited by Phantom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...