Locking
Locking
Posted Sep 24, 2024 2:56 UTC (Tue) by viro (subscriber, #7872)In reply to: Locking by intelfx
Parent article: Resources for learning Rust for kernel development
How would the compiler verify that a call you've added in the area under mutex will not lead to the same mutex being grabbed? If the answer is "it won't", you need to be able to see that without its assistance. The lack of explicit unlock makes that much harder to see.
Sure, you don't lock to protect the code, or even the data - you lock to protect the invariants. But code is what you change, so unless one's answer to everything (including debugging) is "throw it all away and rewrite from scratch", you do need to be able to reason about the locking state at given spot in the code...
