STRUCT LOCK_CHAIN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct lock_chain(9) ✨

okay bestie, welcome to the Kernel API Manual, section 9 πŸŽ€ today's main character is struct lock_chain, which is literally the lock dependency chain record. yes, it's giving very serious kernel business. no cap.


🌸 NAME 🌸

struct lock_chain β€” the lock dependency chain record πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

ok so here's the whole vibe, exactly as it is:

struct lock_chain {
    unsigned int                    irq_context :  2, depth       :  6,
base        : 24;
    struct hlist_node               entry;
    u64 chain_key;
 };

look at her. she's got bitfields and a hash key. obsessed. πŸ”₯


πŸ’– Members πŸ’–

one by one, bestie, we're going through the whole cast:

  • irq_context β€” this one is exactly the same as irq_context in held_lock (you know, the one below). same energy, same meaning, no notes πŸ’…
  • depth β€” the number of held locks in this chain. how deep does it go? this many. periodt.
  • base β€” the index in chain_hlocks for this chain. like, its home address in that array 🏠
  • entry β€” the collided lock chains in the lock_chain hash list. yes, collision handling. we love a data structure that plays well with others 🫢
  • chain_key β€” the hash key of this lock_chain. the actual key. iconic. πŸ‘‘

🧚 SEE ALSO 🧚

go check out the kernel file ./include/linux/lockdep.h β€” also lockdep_set_novalidate_class(9) and lockdep_set_notrack_class(9). iykyk πŸ’œ


✨ a little reminder from your girl: keep every one of these fields exactly as they are, bitfield widths and all. this is kernel code, bestie, we do not freestyle here 😭

and that's the whole page, fr fr πŸŒˆπŸ’–βœ¨

kisses from the ./include/linux directory β€” dated October 2026 πŸŽ€ this manual page is for struct lock_chain(9) and it's a whole mood. go forth and lock safely, bestie. πŸ¦‹πŸ’…πŸŒΈ

πŸ“¦ where this page comes from