refcount_dec_and_lock(9)
π NAME π
okay so welcome to refcount_dec_and_lock(9), straight out of the Kernel API Manual β the manual page, the moment, the icon. The function is refcount_dec_and_lock, and its official NAME vibe is: return holding spinlock if able to decrement refcount to 0. That's the whole thesis, bestie. π
β¨ SYNOPSIS β¨
bool refcount_dec_and_lock (refcount_t *r , spinlock_t *lock );
π ARGUMENTS π
rβ the refcount. literally the counter in question.lockβ the spinlock to be locked. yes ma'am.
π¦ DESCRIPTION π¦
Similar to atomic_dec_and_lock, it will WARN on underflow π and fail to decrement when saturated at REFCOUNT_SATURATED.
It provides release memory ordering, such that prior loads and stores are done before, and provides a control dependency such that free must come after. See the comment on top for the full lore. π
πΈ RETURN πΈ
trueβ and hold spinlock if able to decrement refcount to0. slay.falseβ otherwise. no spinlock-holding moment for you, bestie.
π SEE ALSO π
- Kernel file
./lib/refcount.c refcount_dec_if_one(9)refcount_dec_not_one(9)refcount_dec_and_mutex_lock(9)refcount_dec_and_lock_irqsave(9)
source/version: ./lib Β· date: October 2026 Β· manual name: refcount_dec_and_lock(9). that's the cute little footer flex, and yes, you may screenshot it. π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms