Unreliable Guide To Locking | ||
---|---|---|
Prev | Chapter 2. Two Main Types of Kernel Locks: Spinlocks and Semaphores | Next |
Sometimes a bottom half might want to share data with another bottom half (especially remember that timers are run off a bottom half).
Since a bottom half is never run on two CPUs at once, you don't need to worry about your bottom half being run twice at once, even on SMP.
Since only one bottom half ever runs at a time once, you don't need to worry about race conditions with other bottom halves. Beware that things might change under you, however, if someone changes your bottom half to a tasklet. If you want to make your code future-proof, pretend you're already running from a tasklet (see below), and doing the extra locking. Of course, if it's five years before that happens, you're gonna look like a damn fool.