1 |
Apparently, though unproven, at 17:14 on Tuesday 10 May 2011, Helmut Jarausch |
2 |
did opine thusly: |
3 |
|
4 |
> On 05/10/2011 04:57:05 PM, Sebastian Beßler wrote: |
5 |
> > Am 10.05.2011 16:49, schrieb Helmut Jarausch: |
6 |
> > > And that tells me that the CPU is running at full speed (3 GHz in |
7 |
> > |
8 |
> > my |
9 |
> > |
10 |
> > > case) although all CPUs are idle. |
11 |
> > |
12 |
> > What does |
13 |
> > cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor |
14 |
> > and |
15 |
> > cat /sys/devices/system/cpu/cpu0/cpufreq/ |
16 |
> > scaling_available_frequencies |
17 |
> > and |
18 |
> > cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors |
19 |
> > say? |
20 |
> |
21 |
> I have tried |
22 |
> echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/ |
23 |
> scaling_governor |
24 |
> |
25 |
> and now I see an effect but not as good as powernowd |
26 |
> e.g. I have stopped processed temporarily so that the CPU usage fell |
27 |
> down to 1% (max). Still after waiting some minutes, only one core |
28 |
> scaled down to 800 MHz and a a second one to 2.3 GHz. |
29 |
> |
30 |
> At least, powernowd it much more "agressive". |
31 |
> If some cores are idle for a few seconds it scales these down stepwise |
32 |
> to the lowest frequency. |
33 |
|
34 |
The authors of powertop (employed by Intel) researched this topic extensively |
35 |
and wrote up their findings on the project website and in the package docs. |
36 |
|
37 |
In summary, it goes something like this: |
38 |
|
39 |
Userspace cpu freq daemons are a waste of time, it takes excessive energy to |
40 |
step wise change performance up and down. What you really want is for the cpu |
41 |
to run full speed when it has something to do, get it done as quickly as |
42 |
possible then rapidly fall back to the lowest idle speed once the job is |
43 |
complete. That is how the ondemand governor is written. |
44 |
|
45 |
I suppose this step-down-through-the-levels nonsense comes from flawed |
46 |
comparisons with combustion engines and turbines - it makes sense to ramp |
47 |
these up and down. It does not make sense to do this with a cpu as a cpu is a |
48 |
completely different beast altogether. It is either doing something or |
49 |
nothing; actually it never does nothing - it always does something even if |
50 |
that is just the no-op instruction in a loop. And cpus do not "accelerate" |
51 |
like engines and use almost no additional power to go from min to max speed. |
52 |
So when something useful comes along to do, just switch over to max speed and |
53 |
get the job done. |
54 |
|
55 |
Really, this powernowd stuff looks neat on paper but the actual numbers say |
56 |
otherwise. Just enable ondemand, disable everything else, and et the kernel |
57 |
get on with doing what it does best: |
58 |
|
59 |
the kernel should never try and be clever and second guess you, that way lies |
60 |
madness. Similarly, you should never try and be clever and second guess the |
61 |
kernel. That way also lies madness. |
62 |
|
63 |
|
64 |
-- |
65 |
alan dot mckinnon at gmail dot com |