Unreliable Guide To Locking | ||
---|---|---|
Prev | Chapter 2. Two Main Types of Kernel Locks: Spinlocks and Semaphores | Next |
Sometimes a tasklet might want to share data with another tasklet, or a bottom half.
Since a tasklet is never run on two CPUs at once, you don't need to worry about your tasklet being reentrant (running twice at once), even on SMP.
If another tasklet (or bottom half, such as a timer) wants to share data with your tasklet, you will both need to use spin_lock() and spin_unlock() calls. spin_lock_bh() is unnecessary here, as you are already in a tasklet, and none will be run on the same CPU.