Locking:(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ Locking: πŸŽ€

okay bestie, welcome to the Kernel API Manual β€” yes this is literally the locking page and yes it's short but it's IMPORTANT, so stay with me πŸ’–


✨ Locking: ✨

okay so first thing, ovs_lock is the main character here πŸ‘‘ β€” all writes are protected by it. and when I say all writes I mean ALL of them, like:

  • writes to device state β€” and yes that includes add/remove datapath, port, set operations on vports, etc. πŸ› οΈ
  • writes to other state β€” flow table modifications, set miscellaneous datapath parameters, etc. πŸŒ€

both of those categories? ovs_lock. no cap. πŸ”’

Meanwhile, reads are protected by RCU β€” that's a whole different vibe, she runs lock-free-ish and we love her for it 🌸

Then there's the little squad of special cases (mostly stats) that have their own synchronization β€” but ngl they're lowkey chill because they nest under all of the above and they don't interact with each other. so they're independent, but still polite and hierarchical about it 🫢

and the nesting order, since you asked:

  • the RTNL lock nests inside ovs_mutex πŸ’…

that's it. that's the hierarchy. respect it. periodt. πŸ”₯


🌈 SEE ALSO 🌈

  • Kernel file ./net/openvswitch/datapath.c β€” go read the source, iykyk πŸ“–

fr fr please don't mess with the locking order, bestie β€” the nesting rules are the whole point πŸ™ˆ

and that's a wrap, gorgeous ✨ this page came to you from ./net/openvswitch, dated October 2026, under the manual name Locking:(9) πŸ’œ mwah, go write some correctly-locked kernel code πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from