Revision 1 as of 2007-05-30 07:34:08
This is the reply by Rik van Reil to a mail asking about the difference between "fast path" and "slow path" on kernelnewbies.
converted to 1.6 markup
|No differences found!|
What is the difference between terms: "Slow path" and "Fast path" ?
In general, "fast path" is the commonly run code that should finish very quickly. For example, when it comes to spinlocks the fast path is that nobody is holding the spinlock and the CPU that wants it can just take it.
Conversely, the slow path for spinlocks is that the lock is already taken by somebody else and the CPU will have to wait for the lock to be freed.
The first case is the common one that should be optimized.
The second one is not as important and does not need to be optimized much at all.
In this example, the reason for not optimizing the spinlock code for dealing with lock contention is that locks should not be contended. If they are, we need to redesign the data structures or the code to avoid contention in the first place!
You will see similar tradeoffs in the page locking code, the scheduler code (common cases are fast, unlikely things are put out of line by the compiler and are "behind a jump") and many other places in the kernel.