raw_atomic_...turn_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_...turn_relaxed(9) β€” aka raw_atomic_add_return_relaxed

okok so real talk, this is a page from the Kernel API Manual, section 9 of the manual pages, and the header up top literally reads raw_atomic_...turn_relaxed(9) (yes the title got cut off mid-word, she's a little shy, but the actual star of the show is raw_atomic_add_return_relaxed, ok?? don't let the truncation gaslight you πŸ’€). Anyway. Sit down bestie, we're doing atomics.


✨ NAME ✨

raw_atomic_add_return_relaxed β€” atomic add with relaxed ordering. that's it. that's the whole vibe. one tiny add, zero drama, and she tells you the new value afterwards like a queen πŸ‘‘


🌸 SYNOPSIS 🌸

int raw_atomic_add_return_relaxed (int i , atomic_t *v );

look at her. so clean. so simple. give her an int and an atomic_t * and she'll handle the rest 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an int, and specifically the value you wanna add. it's giving "little number, big responsibility" πŸ’–
  • v β€” a pointer to an atomic_t. this is the counter she's gonna bump, and she's gonna bump it atomically, no cap.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the actual tea β˜•: she atomically updates v to be (v + i), and she does it with relaxed ordering. like, relaxed. chill. no extra fencing, no memory-barrier theatrics, just the add and she's out 🧚✨

and here's the important bit, bestie, don't skip this: it is safe to use in noinstr code πŸ’―. but elsewhere, she said prefer atomic_add_return_relaxed β€” like, if you're not in noinstr land, go hang out with that one instead. it's not a diss, it's just the correct door to knock on πŸšͺ


πŸ”₯ RETURN πŸ”₯

the updated value of v. she gives you the receipt. you add i, you get the new number back, not the old one. iconic behaviour honestly πŸ‘‘


🌈 SEE ALSO 🌈

and now, the part you've all been waiting for, the most main-character SEE ALSO list in the entire kernel 😭 she has so many cousins. first up, the source file:

  • Kernel file ./include/linux/atomic/atomic-arch-fallback.h

πŸ’œ the 32-bit fam

⭐ the 64-bit fam

like I said. so many cousins. family reunion energy fr fr 🫢


πŸ’€ tiny reminder bestie: relaxed ordering means relaxed ordering. don't go assuming barriers she never promised you. and remember β€” noinstr βœ…, everywhere else β†’ go use atomic_add_return_relaxed ✨

and that's the page!! mwah πŸ’– this little icon lives in ./include/linux/atomic, dated October 2026, and it's brought to you by the same raw_atomic_...turn_relaxed(9) header she walked in with. periodt. go add some integers, you've got this πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from