On 2/27/2010 8:41, Tomasz Chmielewski wrote:
> Does offlining a CPU save power?

the short answer is "not the way you think it does".

>
> For example, if I do something like this on a Core i7 CPU - will it save
> any power?
>
> echo 0>  /sys/devices/system/cpu/cpu2/online
> echo 0>  /sys/devices/system/cpu/cpu3/online
> echo 0>  /sys/devices/system/cpu/cpu4/online
> echo 0>  /sys/devices/system/cpu/cpu5/online
> echo 0>  /sys/devices/system/cpu/cpu6/online
> echo 0>  /sys/devices/system/cpu/cpu7/online
>
>
> Say, I have a PC which needs to be turned on all the time, but is mostly
> idle at night.


Now there are two questions:

1) Does offlining a CPU save energy
2) Does offlining a CPU save power

the difference being, that energy is the accumulation over time (the thing you 
pay the electricity company),
while power is an instantanious thing.

Offlining a CPU does not save energy. Best case, you move spread the work out 
over time, but that's generally actually
bad for your energy bill, not good.
The case where it would spread work over time is where you have multiple things 
to do at the same time. Now,
the way cpus work nowadays, there is a certain of cost you get for having ANY 
core active, in addition to the power cost
of the core itself (think "memory controller" and such). In general, once you 
pay the cost for getting ANY core active,
it's better to run all things at once.
As a simple math example,
lets say the cpu when entirely idle takes 1 Watt of power
lets say the cost for having any core is 3 Watts
and lets say that the cost for an active core is 10 Watts
(these numbers are completely made up, just to show the point)

Now, lets say you have two tasks, each taking half a second, and we look at one 
second of time

scenario 1: offline all cores except one => 1 second of activity
   total energy = 1 Watt * 1 second + 3 Watts * 1 second + 10 Watts * 1 seconds 
= 14 Joules

scenario 2: all cores active, but idle when not used => 0.5 seconds of 
activity, then 0.5 seconds idle
   total energy = 1 Watt * 1 second + 3 Watts * 0.5 seconds + 2 * 10 Watts * 
0.5 seconds = 12.5 Joules

the point? it's generally better to let run things in parallel than to make 
them take longer.

Note: in case you didn't realize this: all such an offline does is put the CPU 
in the lowest idle state (C6).. which the kernel also does if 
you are not using the CPU.. there's no fundamental difference between the power 
an offline CPU takes versus the power an idle cpu takes.


Now on the power question:
Offlining cores WILL limit the total amount of power you will draw at any point 
in time. This can be useful if you have a power delivery 
issue in your data center for example.... in a power delivery limit situation 
you care about instant power, and you're ok if it costs you 
more energy; blowing a fuse is worse than a slightly higher bill.

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to