User Tools

Site Tools


mywiki:linux:linux_kernel_notes

This is an old revision of the document!


Spin Lock

Table of Minimum Spin Lock Requirements

The following table lists the minimum locking requirements between various contexts. In some cases, the same context can only be running on one CPU at a time, so no locking is required for that context (eg. a particular thread can only run on one CPU at a time, but if it needs shares data with another thread, locking is required).

Remember the advice above: you can always use spin_lock_irqsave(), which is a superset of all other spinlock primitives.

IRQ Handler A IRQ Handler B Softirq A Softirq B Tasklet A Tasklet B Timer A Timer B User Context A User Context B
IRQ Handler A None
IRQ Handler B spin_lock_irqsave None
Softirq A spin_lock_irq spin_lock_irq spin_lock
Softirq B spin_lock_irq spin_lock_irq spin_lock spin_lock
Tasklet A spin_lock_irq spin_lock_irq spin_lock spin_lock None
Tasklet B spin_lock_irq spin_lock_irq spin_lock spin_lock spin_lock None
Timer A spin_lock_irq spin_lock_irq spin_lock spin_lock spin_lock spin_lock None
Timer B spin_lock_irq spin_lock_irq spin_lock spin_lock spin_lock spin_lock spin_lock None
User Context A spin_lock_irq spin_lock_irq spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh None
User Context B spin_lock_irq spin_lock_irq spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh spin_lock_bh down_interruptible None
mywiki/linux/linux_kernel_notes.1427962724.txt.gz · Last modified: (external edit)