atomic64_sub_return_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_sub_return_relaxed πŸ’…

okay so you're reading the Kernel API Manual bestie, and this one's a whole vibe β€” it's the atomic64_sub_return_relaxed(9) page, and honestly? iconic. let's get into it 🫢


✨ NAME ✨

atomic64_sub_return_relaxed β€” atomic subtract with relaxed ordering πŸ’«


πŸ¦‹ SYNOPSIS πŸ¦‹

s64 atomic64_sub_return_relaxed (s64 i , atomic64_t *v );

πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” the s64 value you're gonna subtract. that's the number going bye-bye πŸ’…
  • v β€” pointer to your atomic64_t. this is the main character, the thing actually getting updated 🎯

πŸ’– DESCRIPTION πŸ’–

so basically it atomically updates v to (v - i) with relaxed ordering. atomically means nobody's gonna catch it mid-update, no cap β€” it's all-or-nothing, one clean operation ✨

⚠️ noinstr warning, fr fr: this is unsafe to use in noinstr code. if you're in there, use raw_atomic64_sub_return_relaxed instead. like, do not try it. the kernel will not be cute about it πŸ’€

🌈 RETURN 🌈

the updated value of v. that's it, that's the whole return β€” the fresh new number after the subtraction πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/linux/atomic/atomic-instrumented.h, plus literally the entire atomic extended family (they're all here, every single one, we don't gatekeep 😭):

the atomic girlies β€” reads & sets

atomic add squad

atomic sub squad

atomic inc squad

atomic dec squad

atomic bitwise besties (and / andnot / or / xor)

atomic swaps & compares

atomic tests, unlesses & positivity checks

now the 64-bit edition, aka our own household 🧚

and the atomic_long crew, showing up fashionably late πŸ’œ


and that's the page bestie πŸŽ€ slay. it lives at ./include/linux/atomic, this version is dated October 2026, and the header on it is still atomic64_sub_return_relaxed(9) obviously β€” go forth and subtract atomically, relaxed-style, but NOT in noinstr code, iykyk πŸ’€βœ¨πŸ’–

πŸ“¦ where this page comes from