raw_atomic64..._dec_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic64..._dec_release(9)

okay so bestie, welcome to the Kernel API Manual 🌸 β€” this page is literally titled raw_atomic64..._dec_release(9) and it's the whole rundown on the release-flavored atomic64 decrement. no cap, it's short, it's iconic, let's get into it πŸ’–


✨ NAME ✨

raw_atomic64_fetch_dec_release β€” atomic decrement with release ordering. that's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

s64 raw_atomic64_fetch_dec_release (atomic64_t *v );

(the spacing is exactly how the kernel wrote it, don't come for me πŸ™ˆ)


πŸ’œ ARGUMENTS πŸ’œ

  • v β€” pointer to atomic64_t. it's giving "hand me the address of your counter please" 🫢

πŸ”₯ DESCRIPTION πŸ”₯

so what does it actually do. it atomically updates v to (v - 1) with release ordering ✨

the way that works: you get the decrement and the release ordering in one neat little package, no extra steps, no drama πŸ’…

and a lil note that matters: this one is safe to use in noinstr code. but if you're not in noinstr code, the manpage says to prefer atomic64_fetch_dec_release elsewhere β€” like, that's the general-purpose one, this is the "I'm deep in the guts of the kernel" one. two different shoes for two different fits πŸ‘‘

⭐ RETURN ⭐

it hands back the original value of v β€” aka the value from before the decrement, not after. the way that trips people up 😭 so if v was 7, you get 7 back and v is now 6. periodt.


🌈 SEE ALSO 🌈

first up, the kernel file that lives at:

./include/linux/atomic/atomic-arch-fallback.h

then the whole extended family β€” like, the entire family tree. buckle up bestie, it's a long group chat 😭

the 32-bit raw_atomic_* crew:

  • raw_atomic_read, raw_atomic_read_acquire, raw_atomic_set, raw_atomic_set_release
  • raw_atomic_add, raw_atomic_add_return, raw_atomic_add_return_acquire, raw_atomic_add_return_release, raw_atomic_add_return_relaxed
  • raw_atomic_fetch_add, raw_atomic_fetch_add_acquire, raw_atomic_fetch_add_release, raw_atomic_fetch_add_relaxed
  • raw_atomic_sub, raw_atomic_sub_return, raw_atomic_sub_return_acquire, raw_atomic_sub_return_release, raw_atomic_sub_return_relaxed
  • raw_atomic_fetch_sub, raw_atomic_fetch_sub_acquire, raw_atomic_fetch_sub_release, raw_atomic_fetch_sub_relaxed
  • raw_atomic_inc, raw_atomic_inc_return, raw_atomic_inc_return_acquire, raw_atomic_inc_return_release, raw_atomic_inc_return_relaxed
  • raw_atomic_fetch_inc, raw_atomic_fetch_inc_acquire, raw_atomic_fetch_inc_release, raw_atomic_fetch_inc_relaxed
  • raw_atomic_dec, raw_atomic_dec_return, raw_atomic_dec_return_acquire, raw_atomic_dec_return_release, raw_atomic_dec_return_relaxed
  • raw_atomic_fetch_dec, raw_atomic_fetch_dec_acquire, raw_atomic_fetch_dec_release, raw_atomic_fetch_dec_relaxed
  • raw_atomic_and, raw_atomic_fetch_and, raw_atomic_fetch_and_acquire, raw_atomic_fetch_and_release, raw_atomic_fetch_and_relaxed
  • raw_atomic_andnot, raw_atomic_fetch_andnot, raw_atomic_fetch_andnot_acquire, raw_atomic_fetch_andnot_release, raw_atomic_fetch_andnot_relaxed
  • raw_atomic_or, raw_atomic_fetch_or, raw_atomic_fetch_or_acquire, raw_atomic_fetch_or_release, raw_atomic_fetch_or_relaxed
  • raw_atomic_xor, raw_atomic_fetch_xor, raw_atomic_fetch_xor_acquire, raw_atomic_fetch_xor_release, raw_atomic_fetch_xor_relaxed
  • raw_atomic_xchg, raw_atomic_xchg_acquire, raw_atomic_xchg_release, raw_atomic_xchg_relaxed
  • raw_atomic_cmpxchg, raw_atomic_cmpxchg_acquire, raw_atomic_cmpxchg_release, raw_atomic_cmpxchg_relaxed
  • raw_atomic_try_cmpxchg, raw_atomic_try_cmpxchg_acquire, raw_atomic_try_cmpxchg_release, raw_atomic_try_cmpxchg_relaxed
  • raw_atomic_sub_and_test, raw_atomic_dec_and_test, raw_atomic_inc_and_test
  • raw_atomic_add_negative, raw_atomic_add_negative_acquire, raw_atomic_add_negative_release, raw_atomic_add_negative_relaxed
  • raw_atomic_fetch_add_unless, raw_atomic_add_unless, raw_atomic_inc_not_zero, raw_atomic_inc_unless_negative, raw_atomic_dec_unless_positive, raw_atomic_dec_if_positive

and the 64-bit raw_atomic64_* besties (our main character lives here πŸ‘‘):

  • raw_atomic64_read, raw_atomic64_read_acquire, raw_atomic64_set, raw_atomic64_set_release
  • raw_atomic64_add, raw_atomic64_add_return, raw_atomic64_add_return_acquire, raw_atomic64_add_return_release, raw_atomic64_add_return_relaxed
  • raw_atomic64_fetch_add, raw_atomic64_fetch_add_acquire, raw_atomic64_fetch_add_release, raw_atomic64_fetch_add_relaxed
  • raw_atomic64_sub, raw_atomic64_sub_return, raw_atomic64_sub_return_acquire, raw_atomic64_sub_return_release, raw_atomic64_sub_return_relaxed
  • raw_atomic64_fetch_sub, raw_atomic64_fetch_sub_acquire, raw_atomic64_fetch_sub_release, raw_atomic64_fetch_sub_relaxed
  • raw_atomic64_inc, raw_atomic64_inc_return, raw_atomic64_inc_return_acquire, raw_atomic64_inc_return_release, raw_atomic64_inc_return_relaxed
  • raw_atomic64_fetch_inc, raw_atomic64_fetch_inc_acquire, raw_atomic64_fetch_inc_release, raw_atomic64_fetch_inc_relaxed
  • raw_atomic64_dec, raw_atomic64_dec_return, raw_atomic64_dec_return_acquire, raw_atomic64_dec_return_release, raw_atomic64_dec_return_relaxed
  • raw_atomic64_fetch_dec, raw_atomic64_fetch_dec_acquire, raw_atomic64_fetch_dec_relaxed
  • raw_atomic64_and, raw_atomic64_fetch_and, raw_atomic64_fetch_and_acquire, raw_atomic64_fetch_and_release, raw_atomic64_fetch_and_relaxed
  • raw_atomic64_andnot, raw_atomic64_fetch_andnot, raw_atomic64_fetch_andnot_acquire, raw_atomic64_fetch_andnot_release, raw_atomic64_fetch_andnot_relaxed
  • raw_atomic64_or, raw_atomic64_fetch_or, raw_atomic64_fetch_or_acquire, raw_atomic64_fetch_or_release, raw_atomic64_fetch_or_relaxed
  • raw_atomic64_xor, raw_atomic64_fetch_xor, raw_atomic64_fetch_xor_acquire, raw_atomic64_fetch_xor_release, raw_atomic64_fetch_xor_relaxed
  • raw_atomic64_xchg, raw_atomic64_xchg_acquire, raw_atomic64_xchg_release, raw_atomic64_xchg_relaxed
  • raw_atomic64_cmpxchg, raw_atomic64_cmpxchg_acquire, raw_atomic64_cmpxchg_release, raw_atomic64_cmpxchg_relaxed
  • raw_atomic64_try_cmpxchg, raw_atomic64_try_cmpxchg_acquire, raw_atomic64_try_cmpxchg_release, raw_atomic64_try_cmpxchg_relaxed
  • raw_atomic64_sub_and_test, raw_atomic64_dec_and_test, raw_atomic64_inc_and_test
  • raw_atomic64_add_negative, raw_atomic64_add_negative_acquire, raw_atomic64_add_negative_release, raw_atomic64_add_negative_relaxed
  • raw_atomic64_fetch_add_unless, raw_atomic64_add_unless, raw_atomic64_inc_not_zero, raw_atomic64_inc_unless_negative, raw_atomic64_dec_unless_positive, raw_atomic64_dec_if_positive

🫢 okay that's the whole page, go decrement something responsibly. this cutie came out of ./include/linux/atomic, October 2026 edition β€” ty for reading, mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from