Re: High priority tasks break SMP balancer?
From: David Newall
Date: Fri Nov 16 2007 - 14:13:59 EST
There are a couple of points I would make about your python test
harness. Your program compares real+system jiffies for both cpus; an
ideal result would be 1.00. The measurement is taken over a relatively
short period of approximately a half-second, and you kill the CPU hogs
before taking final measurements, even wait for them to die first. You
repeat this measurement, starting and killing CPU hogs each time. Why
do you do that?
What happens if you start the hogs and take the baseline outside of the
loop?
from __future__ import division
import sys, os, time
def getCpuTimes():
cpu0 = 0
cpu1 = 1
for line in open("/proc/stat"):
tokens = line.split()
if tokens[0] == "cpu0":
cpu0 = int(tokens[1]) + int(tokens[3])
elif tokens[0] == "cpu1":
cpu1 = int(tokens[1]) + int(tokens[3])
return cpu0, cpu1
pid = os.spawnl(os.P_NOWAIT, "./priosched")
baseline = getCpuTimes()
while True:
time.sleep(0.5)
current = getCpuTimes()
print "%.04f" % (current[0] - baseline[0]) / (current[1] -
baseline[1])
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/