Unreliable Guide To Locking

Paul Rusty Russell

      rusty@rustcorp.com.au
     


Table of Contents
Introduction
The Problem With Concurrency
Two Main Types of Kernel Locks: Spinlocks and Semaphores
Locks and Uniprocessor Kernels
Read/Write Lock Variants
Locking Only In User Context
Locking Between User Context and BHs
Locking Between User Context and Tasklets/Soft IRQs
Locking Between Bottom Halves
The Same BH
Different BHs
Locking Between Tasklets
The Same Tasklet
Different Tasklets
Locking Between Softirqs
The Same Softirq
Different Softirqs
Hard IRQ Context
Locking Between Hard IRQ and Softirqs/Tasklets/BHs
Common Techniques
No Writers in Interrupt Context
Deadlock: Simple and Advanced
Preventing Deadlock
Overzealous Prevention Of Deadlocks
Per-CPU Data
Big Reader Locks
Avoiding Locks: Read And Write Ordering
Avoiding Locks: Atomic Operations
Protecting A Collection of Objects: Reference Counts
Macros To Help You
Things Which Sleep
The Fucked Up Sparc
Racing Timers: A Kernel Pastime
Further reading
Thanks
Glossary