We earlier mentioned the semaphore object (Chapter 6, Kernel Synchronization – Part 1, in the The semaphore and the mutex section), contrasting it with the mutex. There, you understood that it's preferable to simply use a mutex. Here, we point out that within the kernel, just as there exist reader-writer spinlocks, so do there exist reader-writer semaphores. The use cases and semantics are similar to that of the reader-writer spinlock. The relevant macros/APIs are (within <linux/rwsem.h>) {down,up}_{read,write}_{trylock,killable}(). A common example within the struct mm_struct structure (which is itself within the task structure) is that one of the members is a reader-writer semaphore: struct rw_semaphore mmap_sem;.
Rounding off this discussion, we'll merely mention a couple of other related synchronization mechanisms within the kernel. A synchronization mechanism that is heavily...