Re: [PATCH] cpufreq: ondemand: Introduces stepped frequency increase

From: Corrado Zoccolo
Date: Tue Jul 14 2009 - 10:37:41 EST


On Wed, Jul 8, 2009 at 7:47 PM, Matthew Garrett<mjg@xxxxxxxxxx> wrote:
> On Wed, Jul 08, 2009 at 07:41:23PM +0200, Corrado Zoccolo wrote:
>> Hi Matthew,
>> > Is this a measured powersaving? The ondemand model is based on the
>> > assumption that the idle state is disproportionately lower in power than
>> > any running state, and therefore it's more sensible to run flat out for
>> > short periods of time than run at half speed for longer. Is this
>> > inherently flawed, or is it an artifact of differences in your processor
>> > design?
>>
>> The flawed assumption is that running at doubled frequency halves the
>> completion time.
>> On cpus that can change the core speed without impacting the
>> memory-cache bandwidth
>> (i.e. the Pentium M), workloads that access lot of memory go at the
>> same speed at
>> maximum and minimum frequency.
>> Now I see new CPUs that can flush their cache during deep idle states (Atoms),
>> this aggravates the aforementioned problem, rendering the high
>> frequency state much less appetible.
>
> Do you have numbers to support this? What effect does the ramping up
> have on user-visible latency?
I have the numbers now (see attached).
On my Pentium M machine, I run twice the following test, one with
freq_step = 100, and one with 5, sampling the remaining capacity every
20 minutes, for 12 samples.
* booted from battery after full discharge and full recharge.
* started firefox (with empty page)
* run the script:
for cpu in /sys/devices/system/cpu/cpu[0]/; do
# reset to defaults for my system
cat $cpu/cpufreq/phc_default_vids > $cpu/cpufreq/phc_vids
echo ondemand > $cpu/cpufreq/scaling_governor
echo 0 > $cpu/cpufreq/ondemand/ignore_nice_load
echo 20000 > $cpu/cpufreq/ondemand/sampling_rate
done

for cpu in /sys/devices/system/cpu/cpu[0]/; do
echo $1 > $cpu/cpufreq/ondemand/freq_step;
done

killall xscreensaver
sync
xrandr --output LVDS --off
for i in `seq 0 11`; do
cat /proc/acpi/battery/BAT*/state > test.$1.$i.bat
sleep 1200
done
xrandr --output LVDS --auto
shutdown -h now

The attached tsv shows that freq_step=5 saves around 1%-2% of power
with respect to freq_step=100 (default cpufreq behaviour).
>
> --
> Matthew Garrett | mjg59@xxxxxxxxxxxxx
>



--
__________________________________________________________________________

dott. Corrado Zoccolo mailto:czoccolo@xxxxxxxxx
PhD - Department of Computer Science - University of Pisa, Italy
--------------------------------------------------------------------------
"sample"5100"diff"
0396039600
1380038000
23680364040
33560352040
43400336040
53240320040
63120308040
72960292040
82840276080
92680260080
102520244080
112360232040