Re: acpi-cpufreq; Intel Johnstown (Atom N270)

Forest Bond
2009-08-13T18:29:07Z

[-- Attachment #1: Type: text/plain, Size: 6097 bytes --]

Hi,

On Thu, Aug 13, 2009 at 01:25:57PM -0400, Forest Bond wrote:
> I'm using an Intel Johnstown board with an Atom N270 processor. Performance
> seems to improve dramatically with acpi-cpufreq loaded. This caught me by
> surprise. I had assumed that without loading acpi-cpufreq the CPU would be
> running at its maximum speed all the time.

I ran some tests to get some numbers. My findings indicate that before
acpi-cpufreq is loaded the CPU is running at 800MHz even though /proc/cpuinfo
indicates 1.6GHz.

My test just runs `yes | head -n10000000' and times the execution. Three reps
are done for each set of conditions. Here's a break down of the results:

======================= ============
Conditions Average Time
----------------------- ------------
acpi-cpufreq not loaded 2.641s

acpi-cpufreq loaded 1.349s
performance governor

acpi-cpufreq loaded 2.640s
userspace governor
scaling_max_freq 800000
======================= ============

Actual results follow.

Here's my test script:

#!/bin/bash

set -o xtrace

for rep in 1 2 3; do
grep '^cpu MHz' /proc/cpuinfo
uptime
time yes | head -n10000000 >/dev/null
done

Results without acpi-cpufreq:

root@platform:~# ./test.sh
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1596.060
cpu MHz : 1596.060
+ uptime
18:08:37 up 6 min, 1 user, load average: 0.06, 0.66, 0.43
+ yes
+ head -n10000000

real 0m2.647s
user 0m2.844s
sys 0m0.420s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1596.060
cpu MHz : 1596.060
+ uptime
18:08:40 up 6 min, 1 user, load average: 0.13, 0.66, 0.43
+ yes
+ head -n10000000

real 0m2.655s
user 0m2.748s
sys 0m0.528s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1596.060
cpu MHz : 1596.060
+ uptime
18:08:43 up 6 min, 1 user, load average: 0.13, 0.66, 0.43
+ yes
+ head -n10000000

real 0m2.622s
user 0m2.872s
sys 0m0.428s

Then with acpi-cpufreq and the default performance governor:

root@platform:~# modprobe acpi-cpufreq
root@platform:~# ./test.sh
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1600.000
cpu MHz : 1600.000
+ uptime
18:09:11 up 6 min, 1 user, load average: 0.13, 0.61, 0.42
+ yes
+ head -n10000000

real 0m1.354s
user 0m1.392s
sys 0m0.240s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1600.000
cpu MHz : 1600.000
+ uptime
18:09:12 up 6 min, 1 user, load average: 0.13, 0.61, 0.42
+ yes
+ head -n10000000

real 0m1.339s
user 0m1.440s
sys 0m0.284s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 1600.000
cpu MHz : 1600.000
+ uptime
18:09:14 up 6 min, 1 user, load average: 0.13, 0.61, 0.42
+ yes
+ head -n10000000

real 0m1.354s
user 0m1.404s
sys 0m0.264s
root@platform:~# grep '' /sys/devices/system/cpu/cpu0/cpufreq/*
/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus:0 1
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq:1600000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq:1600000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies:1600000 1333000 1067000 800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:performance
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:1600000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:1600000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq:800000

Then with the userspace governor and the frequency set to 800MHz:

root@platform:~# modprobe cpufreq_userspace
root@platform:~# echo 800000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
root@platform:~# grep '' /sys/devices/system/cpu/cpu0/cpufreq/*
/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus:0 1
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq:1600000
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies:1600000 1333000 1067000 800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:userspace performance
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq:800000
root@platform:~# echo 800000 >/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
root@platform:~# ./test.sh
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 800.000
cpu MHz : 800.000
+ uptime
18:12:32 up 9 min, 1 user, load average: 0.00, 0.32, 0.34
+ yes
+ head -n10000000

real 0m2.627s
user 0m2.808s
sys 0m0.496s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 800.000
cpu MHz : 800.000
+ uptime
18:12:35 up 10 min, 1 user, load average: 0.00, 0.32, 0.34
+ yes
+ head -n10000000

real 0m2.643s
user 0m2.732s
sys 0m0.544s
+ for rep in 1 2 3
+ grep '^cpu MHz' /proc/cpuinfo
cpu MHz : 800.000
cpu MHz : 800.000
+ uptime
18:12:37 up 10 min, 1 user, load average: 0.16, 0.34, 0.34
+ yes
+ head -n10000000

real 0m2.651s
user 0m2.848s
sys 0m0.424s

Thoughts?

-Forest