refcount_dec(9)
π NAME π
refcount_dec(9) β decrement a refcount, and yep this is the Kernel API Manual page for it, bestie π
β¨ SYNOPSIS β¨
void refcount_dec (refcount_t *r );
π ARGUMENTS π
rβ the refcount, aka the lil counter getting decremented π«Ά
πΈ DESCRIPTION πΈ
Okay so listen: refcount_dec is similar to atomic_dec, but with boundaries and main-character safety energy. It will WARN on underflow π and it will fail to decrement when it's saturated at REFCOUNT_SATURATED. Like, the counter said βnope, we're maxed out,β periodt.
It also provides release memory ordering, such that prior loads and stores are done before. So the earlier load/store business is completed first β release ordering slay π β¨
π¦ SEE ALSO π¦
Kernel file ./include/linux/refcount.h is the home base π β go give these related pages some love too:
refcount_set(9)refcount_set_release(9)refcount_read(9)refcount_add_not_zero(9)refcount_add_not_zero_acquire(9)refcount_add(9)refcount_inc_not_zero(9)refcount_inc_not_zero_acquire(9)refcount_inc(9)refcount_sub_and_test(9)refcount_dec_and_test(9)
Sign-off time π this page lives in the ./include/linux source tree, dated October 2026, and it's literally refcount_dec(9) β bye bestie, go decrement responsibly ππ¦
π¦ 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