# powersaving and performance.

## neuron

I have a quad core system I'm running cpu frequency scaling on, and the performance hit is quite nasty.

emerging boost (drop_caches and emerged without ccache on every test)

With Performance governor:

3 min 57 sec

With Ondemand:

5 min 6 seconds

With Ondemand + ignore_nice_load

4 min 36 seconds

Any way to get ondemand to be a bit more aggressive?  up_threshold is at 31, so that should be fine.  If possible I'd like the opposite of the conservative govorner, one that's less aggressive with decreasing the cpu speed.  I primarly want this for when I'm not at the computer.

----------

## nativemad

With cpufreqd, it quite easy to define special rules... 

The example config is a good starting point, even if its for a notebook... Just leave out the ac and battery states!  :Wink: 

Cheers

----------

## neuron

 *nativemad wrote:*   

> With cpufreqd, it quite easy to define special rules... 
> 
> The example config is a good starting point, even if its for a notebook... Just leave out the ac and battery states! 
> 
> Cheers

 

All cpufreqd does is set powersave/ondemand in the kernel isn't it?  So it wouldn't change anything for performance.

----------

## nativemad

You can see the actual frequency of your cpu with "cat /proc/cpuinfo"....

With cpufreqd, you can have rules to increase the frequency on demand!

You can define rules which scales your cpus as needed!

for example:

```

[Profile]

 name=On Demand High

 minfreq=60%

 maxfreq=100%

 policy=ondemand

[/Profile]

[Profile]

 name=On Demand Low

 minfreq=20%

 maxfreq=60%

 policy=ondemand

[/Profile]

[Rule]

 name=Normal idle state

 cpu_interval=0-40

 profile=On Demand Low

[/Rule]

[Rule]

 name=perfom better

 cpu_interval=40-100

 profile=On Demand High

[/Rule]

```

----------

## neuron

Very nice, I didn't know cpufreqd could set it based on cpu usage, I thought it was only on AC states.

BUT I can't quite get it working.  What I wanted was simple, using ondemand (with full ondemand scaling) on low cpu usage, switching to performance policy under load.

```

[Profile]

name=ondemand

minfreq=20%

maxfreq=100%

policy=ondemand

[/Profile]

[Profile]

name=performance

minfreq=100%

maxfreq=100%

policy=performance

[/Profile]

[Rule]

name=cpuLow

cpu_interval=ALL:0-80

profile=ondemand

[/Rule]

[Rule]

name=cpuHigh

cpu_interval=ANY:80-100

profile=performance

[/Rule]

```

I ran this with verbosity set high, and both rules get the same score.  And I really dont know why.  It should go cpuLow when all cpu's are from 0-80% cpu usage, and switch to performance if any cpu is maxed from what I see.  But this is the result:

update_rule_scores       : Rule "cpuLow" score: 101%

update_rule_scores       : Rule "cpuHigh" score: 101%

I removed the ANY and ALL rules, then cpuLow gets 101%, cpuHigh 0%, regardless of load  :Sad:  (and I did peg every cpu to 100%, still shows it as 0% score).

----------

## nativemad

I must admit, that i've never used it on smp so far!

But mine is also showing strange scores...101%, 0% and one with 51%! Thats strange, because its working like it should... when it switches, the one with 101 gets 0 and vice versa.

Perhaps you should set the poll_interval a bit lower or so? Or in the ondemand profile the maxfreq under 100%?

Maybe it's also the ANY/ALL thing, because when with ANY, a cpu gets 100 load, its still in ALL under 80!   :Wink: 

----------

## drescherjm

I set my desktops to ondemand and make the upthreshold to 15 which is the lowest value. Here is a section of my /etc/conf.d/local.start

```

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo 15 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

echo ondemand > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor

echo 15 > /sys/devices/system/cpu/cpu2/cpufreq/ondemand/up_threshold
```

----------

## Mad Merlin

I like sys-power/cpudyn, it's a nice simple userspace tool that clocks the CPU up and down as needed.

Years ago, when I first started using it, I found no perceptible difference in performance with and without it (but, with a large power savings of course), so I use it on all of my computers, both laptop and desktop.

----------

## neuron

the result of a few days without an internet connection to check this thread : http://aagaande.googlecode.com/svn/trunk/cpuGovernator/

 :Razz: 

Checks cpu usage, and goes to performance if needed, also checks cpu heat through coretemp sensors (only available on intel I believe?), and sets any specific cpu going over X degrees to powersave.

----------

## drescherjm

only available on intel I believe?)

Yes AMD64 cpus use k8temp which is very similar.

----------

