Re: Clock Watching the Scheduler 2.2.10unip

Richard B. Johnson (root@chaos.analogic.com)
Mon, 27 Sep 1999 22:11:38 -0400 (EDT)


On Mon, 27 Sep 1999, Robert Redelmeier wrote:

> While trying to determine kernel overhead, I wrote a small pgm
> (below) using `rdtsc` to figure out kernel interrupts. I get
> some strange results:
>
> 1) 500 interrupts take 5 seconds. No surprise there. Except
> on SMP (& FreeBSD2.2.8) systems, where they only take
> ~2.7 seconds. Are these spurrious interrupts? Or SMP?
>

Strange. I routinely handle 50,000 interrupts per second.


> 2) Most interrupts take ~5600 cycles to process on a 530 MHz Cel,
> and ~2600 on 200 MHz PPro. This is better than FreeBSD
> 2.2.8 where they take ~5200 on a PPro 200. But `way longer
> than the 700-900 for a hardware int/iret pair.
>
> 3) There's considerable scatter in the results, even with caches
> turned off. A nice upper tail occurs with other running
> processes that shows the length of their timeslices.
>
> 4) Most surprising, on the one system I could control caches,
> disabling L1 and/or L2 made _NO_ difference. Still 5600
> clocks. Is there some cache flushing going on? Why?
>
> Here's clockwatcher:
>

Erm.. How is this supposed to measure interrupts?


> #include <stdio.h>
> #include <asm/msr.h>
> #include <linux/config.h>
> main () {
> unsigned long i, c, t ;
> for (i = 0; i < 500; i++ ) {
> c = t = 0 ;
> rdtscl(t);
> do {
> c = t ;
> rdtscl(t);
> } while ((t-c) < 90) ;
> printf(" %lu\n",(t-c+32)&-64);
> }
> }
>

Could you please explain how this has anything to do with interrupts?
I see you looping on the cpu clock for an abitrary count (< 90), and
doing this another abitrary amount (500), and printing some abitrary
manipulation of the last residual.

It's true. I just don't get it. Are you thinking that the kernel's
preemption of your task is an interrupt? Even though the preemption
occurs, sometimes using an interrupt, it is hardly an interrupt.
When you are trying to write stuff to the terminal, if the buffer's
full, you lose, you are preempted (sleep). What you seem to me
measuring is the effect of overloading your output buffer.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/