This page contains a collection of notes and tools related to an
effort to decrease the typical scheduling latency of the 2.4.x kernel.
What schedlat does is to record the interval between a process entering
the kernel and leaving the kernel. A process may enter the kernel
in one of the following ways:
| |
______|___________|___________________________
syscall_start | 0 | | | 2 | 3 | | | 5 | 6 | 7 | 8 |
9 | |
------+-----------+--------------------------
A | C |
______|________ | _______________________
switchout | | |
| | | |
| | | | |
------+-------- | -----------------------
| |
______|________ | _______________________
switchin |
| | | | | |
| | | | |
------+-------- | -----------------------
B | |
______|___________|__________________________
syscall_stop | | | |
| | | | | | |
| | |
------+-----------+--------------------------
| |
V V
Here, one code path enters syscall1, gets scheduled out, then gets scheduled back in and then exits the system call. In this case schedlat will report the "A" and "B" intervals.
The other code path does not get scheduled out - it simply enters and leaves. schedlat will report the "C" interval.
Here's some sample schedlat output:
start_0004:0 -> stop_0004:0
65401 .30 8035.76
8.64 565621.23
start_0006:0 -> stop_0006:0
1145 .22 7484.32
10.99 12592.34
start_0005:0 -> switchout_0005:0 38
70.57 3729.48 253.28 9624.84
switchin_0005:0 -> switchout_0005:0 23
26.72 3208.19 342.06 7867.62
switchin_0005:0 -> stop_0005:0 38
16.98 2140.33 99.25 3771.69
start_0054:0 -> stop_0054:0
5105 .32 2001.27
1.76 9021.48
start_0002:0 -> stop_0002:0
131 217.87 1882.48 428.13
56085.73
This shows syscall 4 taking 8035 microseconds to enter and exit the kernel.
It shows syscall 5 spending 7,484 microseconds between entering the kernel and getting scheduled out, and taking 2,140 microseconds between getting scheduled in and exitting the system call.
schedlat converts page fault events so they look like system call 255.
After all, page faults are just another way of entering the kernel and
requesting services from it.
Schedlat is part of the timepeg patch, below. It is enabled under the `kernel hacking' configuration item.
Which would indicate that 12,345 interrupts were serviced in one
millisecond, and four interrupts were services in three milliseconds.
Of course, things are worse than this: interrupt service latency will add to these numbers. Did I mention intlat?
If you want to drill down further and find out why there are scheduling 'bumps', rtc-debug won't tell you. schedlat will.
2.4.2-low-latency.patch
(See note below)
2.4.4-low-latency.patch (Thanks
to Mark McCallister)
2.4.5-low-latency.patch.gz
(Thanks to Josh Green)
2.4.7-low-latency.patch.gz
2.4.6-ac5-low-latency.patch.gz
2.4.8-pre6-low-latency.patch.gz
(Thanks to J Sloan)
2.4.8-low-latency.patch.gz
(Thanks to J Sloan)
2.4.9-low-latency.patch.gz
(Thanks to J Sloan and Nick Bellinger)
2.4.10-low-latency.patch.gz
(Thanks to Nick Bellinger)
2.4.11-pre3-low-latency.patch.gz
(Thanks to J Sloan)
2.4.12-ac2-low-latency.patch.gz
2.4.13-low-latency.patch.gz
(Thanks to Martin Schwenke)
2.4.14-low-latency.patch.gz
(Thanks to J Sloan)
2.4.13-ac8-low-latency.patch.gz
2.4.15-pre5-low-latency.patch.gz
2.4.15-pre7-low-latency.patch.gz
2.4.16-low-latency.patch.gz
2.4.17-pre2-low-latency.patch.gz
2.4.17-low-latency.patch.gz
(Also applies to 2.4.18-pre1)
2.4.18-pre6-low-latency.patch.gz
2.4.18-pre9-low-latency.patch.gz
(J Sloan)
2.4.18-rc1-low-latency.patch.gz
2.4.19-pre7-low-latency.patch.gz
2.4.19-pre10-low-latency.patch.gz
(Includes DRM additions from Jussi Laako)
2.4.19-low-latency.patch.gz
2.4.20-low-latency.patch.gz
2.4.21-low-latency.patch.gz
2.4.22-low-latency.patch.gz
2.4.23-low-latency.patch.gz
2.4.25-low-latency.patch.gz
2.4.29-low-latency.patch.gz
Paul Winkler has put up a nice page which shows how to build 2.4 kernels (including this patch).
If something goes wrong and you start seeing scheduling latencies, please try to investigate the source using the above tools (mainly rtc_debug and amlat) and let me know what you're doing to cause this.
Ingo Molnar wrote Linux's first low-latency scheduling patches.
Those patches use the same algorithmic approach as the ones here, and these
patches borrow a few bits and pieces from Ingo's.
Ingo also has patches against the 2.2 kernels.
His work is available at http://people.redhat.com/mingo/lowlatency-patches/