raw_atomic_..._sub_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_..._sub_release(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” yes we're literally in the kernel docs rn, and this page is called raw_atomic_..._sub_release(9) and honestly? it's giving niche but essential. buckle up πŸŽ€


✨ NAME ✨

raw_atomic_long_fetch_sub_release β€” atomic subtract, but make it release ordering πŸ’«


✨ SYNOPSIS ✨

long raw_atomic_long_fetch_sub_release (long i , atomic_long_t *v );

✨ ARGUMENTS ✨

  • i β€” a long value, and it's the amount you're subtracting. the subtraction victim, if you will 🫢
  • v β€” a pointer to an atomic_long_t. this is the actual atomic bestie getting updated πŸ‘‘

✨ DESCRIPTION ✨

so what it does, no cap: it atomically updates v to (v - i), and it does it with release ordering. atomically means nobody sneaks in halfway, okay? the whole subtract-slash-update is one indivisible moment. iconic behavior honestly πŸ’…

it's safe to use in noinstr code β€” like, that's literally its whole niche. everywhere else though? prefer atomic_long_fetch_sub_release, bestie. that's the general-purpose one. this raw version is the specialist 🧚


✨ RETURN ✨

it hands you back the original value of v β€” i.e. what v was before your subtraction happened. so you get the before-pic, and v keeps the after-pic πŸ“Έ


✨ SEE ALSO ✨

first up, the source of truth, the origin story:

  • Kernel file ./include/linux/atomic/atomic-long.h

and now the whole friend group 😭 literally everyone:

πŸ¦‹ the reads

πŸ¦‹ the sets

πŸ¦‹ the adds

πŸ¦‹ the subs (our literal family)

πŸ¦‹ the incs

πŸ¦‹ the decs

πŸ¦‹ the bitwise girlies

πŸ¦‹ the exchanges

πŸ¦‹ the compare-and-swap squad

πŸ¦‹ the tests

πŸ¦‹ the conditional cuties


fr fr go read those if you wanna understand the whole atomic-long cinematic universe. this page is one star in a very big, very shiny constellation ⭐

and that's the whole page babes πŸ’– it lives in ./include/linux/atomic, it's from October 2026, and it's part of the Kernel API Manual. go forth and subtract atomically, you absolute main character πŸ‘‘βœ¨

πŸ“¦ where this page comes from