[PATCH] preemption latency measurement tool

Robert Love
2002-04-09T05:23:13Z

preempt-stats, the preemption-off period measurement tool, has been
updated with new patches for 2.4.18, 2.4.19-pre6, 2.4.19-pre5-ac3,
2.5.7, and 2.5.8-pre2 available at:

http://www.kernel.org/pub/linux/kernel/people/rml/preempt-stats
and
http://tech9.net/rml/linux

A lot of work, courtesy of MontaVista, has gone into this release to
greatly improve the accuracy of the tool's measurements.

This patch instructs the kernel preemption code to measure periods of
non-preemptibility and report the 20 worst in /proc/latencytimes. These
results typically correspond to the 20 longest held spinlocks in your
working kernel. They help pinpoint specific problem areas that need
work. Example results:

cpu 0 worst 20 latency times of 2236 measured in this period.
usec cause mask start line/file address end line/file
9292 BKL 1 2839/buffer.c c0142caf 2842/buffer.c
5999 spin_lock 9 86/softirq.c c011c56d 112/softirq.c
4495 spin_lock 1 401/memory.c c0126f18 422/memory.c
2697 spin_lock 1 671/inode.c c015658a 697/inode.c
... et cetera

The patch obviously requires a preemptive kernel. For 2.4, the patches
are available at the above address. Preempt-kernel is merged in 2.5.

Change Log:

20020409

- make stats code aware of PREEMPT_ACTIVE (Todd Poynor)
- proper start/stop order in preempt_schedule (Todd Poynor)
- explicitly force preempt region on/off in (Todd Poynor)
schedule
- improve reporting wrt interrupts (Todd Poynor)
- missing stop in do_softirq (Todd Poynor)

20020302:

- make preempt-stats report meaningful stats (Todd Poynor)
on SMP
- fix overflow with large latency values on (Todd Poynor)
high clock-rate CPUs

20020204:

- accidently removed preempt_schedule export (Willy Tarreau)
- properly export statistics functions (Willy Tarreau)

Enjoy,

Robert Love