Hi Mark,
Sorry about the delay. Your letter must have come in just as I was
stepping out the door last Friday night.
Such fiddling never `increases performance', it always results in a
massively suboptimal use of system resources. Therefore one shields
only when the loss in performance is a non-issue, compared to the
gain in timely responsiveness to external events experienced by
applications running on the shielded cpus. `Timely responsiveness'
is typically measured by how erratic an application is in responding
to an external event repeated over and over; this variation in
response time I call jitter.
One can measure jitter with a dual trace oscilloscope, a square wave
generator, and a PC with an external input/output interrupt card with
a matching driver which lets an application sleep, waiting on
interrupts from that driver. The test application is a few lines of
C code that loops forever, sending out an external interrupt every
time it wakes up due to the arrival of an input external interrupt.
With channel 1 of the oscilloscope also attached to the square wave
generator and channel 2 attached to the external interrupt output pin
of the PC, one can graphically see on the scope 1) the average delay
time it takes the PC (hardware, driver, OS, and application in toto)
to respond to an interrupt, and 2) the variations (jitter) from that
average time, how often such variations occur, and their magnitude.
Now I haven't run the above test myself for Linux, but one of the
guys here has, and he says that under Linux we see an average delay
between the input and output pulses of 11 microseconds, and that most
of the delays fall within a few microseconds of that. However, there
are occasional delays much longer than this, with the longest being
an occasional 10 MILLIseconds..which would be a a truely horrendous
jitter, if true.
The above is with shielding off; we have not done experiments with
our shielding code turned on in Linux since that is not working yet.
I imagine the 10 millisecond delay is due to the standard linux
scheduler, which is priority-less and often favors running a
currently running program over switching to a newly-runnable program.
The new O(1) scheduler might fix that, although I haven't looked at
it yet to see if my hope has any basis in fact.
Once the scheduler issues are fixed then shielding becomes useful
keeping ordinary, noncritical processes off of a cpu. Process
priority alone does not protect much against the jitter these
processes introduce, as they can at any time enter the kernel via a
system call. There, they can grab spinlocks and lock out interrupts
for short periods of time .. those short periods of time often being
in the 100's of microseconds, for a well-threaded system (which Linux
is not, yet). These lockouts prevent the scheduler from running and
thus are a source of jitter that is 10x of the normal response time of
the PC to an external interrupt.
In combination with process shielding, one also should use IRQ
shielding (/proc/irq/n/affinity interface), in order to steer
interrupts from noncritical devices over to the unshielded cpus.
Interrupt processing is also a source of jitter in the 100's of
microsecond range, and given todays networking cards, whose drivers
like to loop at interrupt level processing boo-ko numbers of packets,
can often hold out interrupts for much longer than 100's of
microseconds..
Joe
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/