refcount_in...zero_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… refcount_in...zero_acquire(9) β€” like, the whole page, bestie

okay so first things first: this is a page from the Kernel API Manual, and the star of the show is refcount_inc_not_zero_acquire. Yes the title got squished into refcount_in...zero_acquire(9) for the header because man pages are dramatic like that. Anyway. Sit down, hydrate, let's go. 🫢


✨ NAME ✨

Not one but two little lines of truth, because that's just how she is:

  • refcount_inc_not_zero_acquire β€” increment a refcount with acquire ordering unless it is 0

Periodt. That's the whole vibe.


🌸 SYNOPSIS 🌸

bool refcount_inc_not_zero_acquire (refcount_t *r );

literally the whole signature. yes the space before the ) is canon, don't @ me. 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • r β€” the refcount to increment. that's it. that's the argument. she's the main character. πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, lowkey, refcount_inc_not_zero_acquire is similar to refcount_inc_not_zero, but it provides acquire memory ordering on success. that's the entire glow-up. ngl it ate. πŸ”₯

Use this one when the memory occupied by the object might be reused to store another object β€” and like, think about SLAB_TYPESAFE_BY_RCU here, fr fr, that's the exact case they're pointing at. πŸ‘€

It provides acquire memory ordering on success, and it's assumed the caller has guaranteed the object memory to be stable (RCU, etc.). Not a "we hope," an assumption β€” so do your part, bestie. πŸ™ˆ

It does provide a control dependency and thereby orders future stores. Also: see the comment on top. yes, that comment. the one at the top. go read it. πŸ’…

like, i cannot stress enough that the "caller has guaranteed the object memory to be stable" bit is on you. this function is not gonna do it for you. ⭐

πŸ’– RETURN πŸ’–

  • true β€” the increment was successful, slay βœ…
  • false β€” otherwise, and that's on the refcount being 0 πŸ’€

🌈 SEE ALSO 🌈

the whole friend group, living in the kernel file ./include/linux/refcount.h:


🧚 sign-off 🧚

sourced straight from ./include/linux, dated October 2026, and yeah the footer still calls her refcount_in...zero_acquire(9) β€” iconic, truncated, no notes. bye bestie, go increment responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from