kref_put_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kref_put_lock(9) πŸ’…

Okay bestie, welcome to the Kernel API Manual β€” this one is short, but it's giving very specific refcount-with-a-lock energy ✨

🌸 NAME 🌸

kref_put_lock β€” Decrement refcount for object πŸŽ€

✨ SYNOPSIS ✨

int kref_put_lock (struct kref *kref , void (*release)(struct kref
*kref) , spinlock_t *lock );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • kref β€” the object, bestie. That's the thing we're working with.
  • release β€” pointer to the function that will clean up the object when the last reference to the object is released. Like, the final goodbye handler πŸ’–
  • lock β€” the spinlock which protects the release function. It's literally the bodyguard for release πŸ”₯

🌈 DESCRIPTION 🌈

Okay so this variant of kref_lock calls the release function with the lock held. The release function will release the lock. That's the whole situation β€” lock held while release does its thing, then release unlocks it. No cap 🫢

⭐ SEE ALSO ⭐

Kernel file ./include/linux/kref.h β€” plus these iconic references, iykyk:


xoxo, signed off by source/version ./include/linux πŸ’– dated October 2026 πŸ’– all for kref_put_lock(9) πŸ’…βœ¨

πŸ“¦ where this page comes from