Bone idle CPUs
by Hugo van der Sanden at 11:53 02/12/09 (Blogs::Hugo)

I don't understand this at all.

This result is consistent:

crypt# /usr/bin/time taskset 1 perl -e '$s+=$_ for 1 .. 5e6'
1.12user 0.00system 0:01.13elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+427minor)pagefaults 0swaps
crypt# /usr/bin/time taskset 2 perl -e '$s+=$_ for 1 .. 5e6'
3.07user 0.00system 0:03.08elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+426minor)pagefaults 0swaps
crypt# 

That is to say: when forced to run on CPU 0, this (makework example) code requires the use of the processor for 1.12 seconds. The same code forced to run on CPU 1 requires the use of the processor for 3.07 seconds.

It took me a week to work out what was causing the random differences in timing for my purely deterministic code, and now I know I am none the wiser. :(

/proc/cpuinfo shows no significant difference between them:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 6
model name      : Intel(R) Pentium(R) D CPU 2.80GHz
stepping        : 4
cpu MHz         : 1400.000
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov
                  pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx
                  lm constant_tsc pni monitor ds_cpl est cid cx16 xtpr lahf_lm
bogomips        : 5589.24
clflush size    : 64

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 6
model name      : Intel(R) Pentium(R) D CPU 2.80GHz
stepping        : 4
cpu MHz         : 1400.000
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov
                  pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx
                  lm constant_tsc pni monitor ds_cpl est cid cx16 xtpr lahf_lm
bogomips        : 5585.56
clflush size    : 64

So why does CPU 1 have to work 3 times as hard as CPU 0 to execute the same code? Is it just stupider?

Hugo

<< Time for a new mail server? Frustrated >>
Powered by
Powered by Novacaster